From 9e42e1c87f3a206f0babc74760ac9a02d8d328f4 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Thu, 27 Dec 2018 15:14:10 +0200 Subject: Implemented Deployment Slots! Implemented Environment AD Groups. Implemented Machine Studio environment selection. --- .../Authentication/DefaultAuthenticationProvider.cs | 13 +------------ .../Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs | 18 +++++++++++++++++- .../Tango.MachineStudio.UI/Views/LoginView.xaml | 8 +++++++- 3 files changed, 25 insertions(+), 14 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI') 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 19192020e..ccaedb359 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs @@ -56,7 +56,7 @@ namespace Tango.MachineStudio.UI.Authentication IWebTransportClient service = new WebTransportClient(); - var response = service.PostJson(settings.MachineServiceAddress + "/api/MachineStudio/Login", new LoginRequest() + var response = service.PostJson(settings.GetMachineServiceAddress() + "/api/MachineStudio/Login", new LoginRequest() { Email = email, @@ -90,17 +90,6 @@ namespace Tango.MachineStudio.UI.Authentication throw new AuthenticationException("Invalid credentials for " + email); } - if (!user.HasPermission(Permissions.RunMachineStudio)) - { - throw new AuthenticationException("It seems like you do not have sufficient privileges to run Machine Studio. Please contact your administrator."); - } - - if (user != null) - { - user.LastLogin = DateTime.UtcNow; - db.SaveChanges(); - } - CurrentUser = user; return user; } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs index 730027a67..edae820e7 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs @@ -46,6 +46,9 @@ namespace Tango.MachineStudio.UI.ViewModels } private String _password; + /// + /// Gets or sets the password. + /// [Required(ErrorMessage = "Password is required")] public String Password { @@ -53,6 +56,16 @@ namespace Tango.MachineStudio.UI.ViewModels set { _password = value; RaisePropertyChangedAuto(); } } + private DeploymentSlots _deploymentSlot; + /// + /// Gets or sets the deployment slot. + /// + public DeploymentSlots DeploymentSlot + { + get { return _deploymentSlot; } + set { _deploymentSlot = value; RaisePropertyChangedAuto(); } + } + private bool _isLogging; /// /// Gets or sets a value indicating whether this instance is logging. @@ -96,6 +109,7 @@ namespace Tango.MachineStudio.UI.ViewModels cryptographer = new Rfc2898Cryptographer(); Email = _settings.LastLoginEmail; + DeploymentSlot = _settings.DeploymentSlot; RememberMe = _settings.RememberMe; try @@ -122,14 +136,16 @@ namespace Tango.MachineStudio.UI.ViewModels await Task.Factory.StartNew(() => { + _settings.DeploymentSlot = DeploymentSlot; + _authenticationProvider.Login(Email, Password); _eventLogger.Log(EventTypes.ApplicationStarted, "Application Started!"); _navigationManager.NavigateTo(NavigationView.MainView); + _settings.LastLoginEmail = Email; _settings.RememberMe = RememberMe; - _settings.LastLoginPassword = RememberMe ? cryptographer.Encrypt(Password) : null; _settings.Save(); diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoginView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoginView.xaml index 68334ad24..c344e867a 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoginView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoginView.xaml @@ -9,6 +9,7 @@ xmlns:automation="clr-namespace:Tango.MachineStudio.Common.Automation;assembly=Tango.MachineStudio.Common" xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" xmlns:helpers="clr-namespace:Tango.SharedUI.Helpers;assembly=Tango.SharedUI" + xmlns:common="clr-namespace:Tango.MachineStudio.Common;assembly=Tango.MachineStudio.Common" xmlns:local="clr-namespace:Tango.MachineStudio.UI.Views" mc:Ignorable="d" d:DesignHeight="720" d:DesignWidth="1280" DataContext="{Binding LoginViewVM, Source={StaticResource Locator}}" Background="Transparent"> @@ -17,6 +18,7 @@ + @@ -28,7 +30,7 @@ Machine Studio - + @@ -44,6 +46,10 @@ + + + + Remember me -- cgit v1.3.1