diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-06-12 19:04:09 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-06-12 19:04:09 +0300 |
| commit | ca50e0c8fc88acd06d6e1932e9412464bff95edb (patch) | |
| tree | aaafb06deca983c1e80c8c34508d23a452e4a235 /Software/Visual_Studio/PPC/Tango.PPC.Common/Authentication | |
| parent | 8a59643571080bfff715f0b0e4bb03e2dee4961a (diff) | |
| download | Tango-ca50e0c8fc88acd06d6e1932e9412464bff95edb.tar.gz Tango-ca50e0c8fc88acd06d6e1932e9412464bff95edb.zip | |
Working on PPC modules and loading.
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common/Authentication')
2 files changed, 19 insertions, 7 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Authentication/DefaultAuthenticationProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Authentication/DefaultAuthenticationProvider.cs index c8e89ac2f..f49beb32d 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Authentication/DefaultAuthenticationProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Authentication/DefaultAuthenticationProvider.cs @@ -3,30 +3,42 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.BL; using Tango.BL.Entities; +using Tango.Core; namespace Tango.PPC.Common.Authentication { - public class DefaultAuthenticationProvider : IAuthenticationProvider + public class DefaultAuthenticationProvider : ExtendedObject, IAuthenticationProvider { + private User _currentUser; + public User CurrentUser { - get + get { return _currentUser; } + private set { - throw new NotImplementedException(); + _currentUser = value; + RaisePropertyChangedAuto(); } } public event EventHandler<User> CurrentUserChanged; - public User Login(string email, string password) + public Task<User> Login(string email, string password) { - throw new NotImplementedException(); + return Task.Factory.StartNew(() => + { + CurrentUser = ObservablesEntitiesAdapter.Instance.Users.SingleOrDefault(x => x.Email.ToLower() == email && x.Password == password); + CurrentUserChanged?.Invoke(this, CurrentUser); + return CurrentUser; + }); } public void Logout() { - throw new NotImplementedException(); + CurrentUser = null; + CurrentUserChanged?.Invoke(this, CurrentUser); } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Authentication/IAuthenticationProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Authentication/IAuthenticationProvider.cs index 0892932a8..0fca03d49 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Authentication/IAuthenticationProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Authentication/IAuthenticationProvider.cs @@ -28,7 +28,7 @@ namespace Tango.PPC.Common.Authentication /// <param name="email">The email.</param> /// <param name="password">The password.</param> /// <returns></returns> - User Login(String email, String password); + Task<User> Login(String email, String password); /// <summary> /// Logs-out the current logged-in user. |
