diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2018-12-24 09:08:25 +0200 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2018-12-24 09:08:25 +0200 |
| commit | 2f77ad3cebf771bdf02188174c9712027b004d41 (patch) | |
| tree | 32d819fbbb57063b9289d39f1cacf4febb83ea28 /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs | |
| parent | 0cc8f5b14286302880f56aaa20a7078b92579a97 (diff) | |
| parent | 99a48d7c388792c96ce7ac1b4e1436d395c4aec1 (diff) | |
| download | Tango-2f77ad3cebf771bdf02188174c9712027b004d41.tar.gz Tango-2f77ad3cebf771bdf02188174c9712027b004d41.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs')
| -rw-r--r-- | Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs index fd68ed8d1..3293dab3f 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs @@ -10,6 +10,9 @@ using Tango.MachineStudio.Common.Authentication; using Tango.BL; using Tango.BL.Enumerations; using System.Data.Entity; +using Tango.Transport.Web; +using Tango.Settings; +using Tango.MachineStudio.Common; namespace Tango.MachineStudio.UI.Authentication { @@ -49,11 +52,21 @@ namespace Tango.MachineStudio.UI.Authentication /// <exception cref="AuthenticationException">Login failed for user " + email</exception> public User Login(string email, string password) { - using (ObservablesContext db = ObservablesContext.CreateDefault()) + var settings = SettingsManager.Default.GetOrCreate<MachineStudioSettings>(); + + IWebTransportClient service = new WebTransportClient(); + var response = service.PostJson<LoginRequest, LoginResponse>(settings.MachineServiceAddress + "/api/MachineStudio/Login", new LoginRequest() { - String hash = User.GetPasswordHash(password); + Email = email, + Password = password, + + }).Result; + ObservablesContext.OverrideSettingsDataSource(response.DataSource); + + using (ObservablesContext db = ObservablesContext.CreateDefault()) + { db.Roles.Load(); db.Permissions.Load(); db.RolesPermissions.Load(); @@ -62,7 +75,7 @@ namespace Tango.MachineStudio.UI.Authentication .Include(x => x.UsersRoles) .Include(x => x.Contact) .Include(x => x.Address) - .Include(x => x.Organization).SingleOrDefault(x => x.Email.ToLower() == email.ToLower() && x.Password == hash); + .Include(x => x.Organization).SingleOrDefault(x => x.Email.ToLower() == email.ToLower()); if (user == null) { |
