aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-12-27 15:14:10 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-12-27 15:14:10 +0200
commit9e42e1c87f3a206f0babc74760ac9a02d8d328f4 (patch)
treebe3be4cf23f524f430146af472883f63dd8bdfb7 /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI
parent894d05d59c0e1612903f1adbf908914f2df67ccc (diff)
downloadTango-9e42e1c87f3a206f0babc74760ac9a02d8d328f4.tar.gz
Tango-9e42e1c87f3a206f0babc74760ac9a02d8d328f4.zip
Implemented Deployment Slots!
Implemented Environment AD Groups. Implemented Machine Studio environment selection.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI')
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs13
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs18
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoginView.xaml8
3 files changed, 25 insertions, 14 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 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<LoginRequest, LoginResponse>(settings.MachineServiceAddress + "/api/MachineStudio/Login", new LoginRequest()
+ var response = service.PostJson<LoginRequest, LoginResponse>(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;
+ /// <summary>
+ /// Gets or sets the password.
+ /// </summary>
[Required(ErrorMessage = "Password is required")]
public String Password
{
@@ -53,6 +56,16 @@ namespace Tango.MachineStudio.UI.ViewModels
set { _password = value; RaisePropertyChangedAuto(); }
}
+ private DeploymentSlots _deploymentSlot;
+ /// <summary>
+ /// Gets or sets the deployment slot.
+ /// </summary>
+ public DeploymentSlots DeploymentSlot
+ {
+ get { return _deploymentSlot; }
+ set { _deploymentSlot = value; RaisePropertyChangedAuto(); }
+ }
+
private bool _isLogging;
/// <summary>
/// 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 @@
<rules:Required x:Key="Required"></rules:Required>
<converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
<converters:BooleanToVisibilityInverseConverter x:Key="BooleanToVisibilityInverseConverter" />
+ <converters:EnumToItemsSourceConverter x:Key="EnumToItemsSourceConverter" />
</UserControl.Resources>
@@ -28,7 +30,7 @@
<Image Source="/Images/machine-trans.png" RenderOptions.BitmapScalingMode="Fant" Width="100"></Image>
<TextBlock Margin="20 0 0 0" VerticalAlignment="Center" FontSize="70" Foreground="{StaticResource AccentColorBrush}">Machine Studio</TextBlock>
</StackPanel>
- <DockPanel HorizontalAlignment="Center" VerticalAlignment="Center" Width="320" Margin="0 120 0 0" Height="398">
+ <DockPanel HorizontalAlignment="Center" VerticalAlignment="Center" Width="320" Margin="0 120 0 0" Height="480">
<Button DockPanel.Dock="Bottom" AutomationProperties.AutomationId="{x:Static automation:UI.LoginButton}" Margin="25 20 0 0" Height="50" Command="{Binding LoginCommand}" Content="LOGIN"></Button>
@@ -44,6 +46,10 @@
<materialDesign:PackIcon Margin="0 0 0 0" Width="20" Height="20" VerticalAlignment="Top" Foreground="{Binding ElementName=txtPass, Path=BorderBrush}" Kind="Key" />
<PasswordBox x:Name="txtPass" helpers:PasswordHelper.Attach="True" helpers:PasswordHelper.Password="{Binding Password,Mode=TwoWay}" Margin="5 0 0 0" materialDesign:HintAssist.FloatingScale="0.50" materialDesign:HintAssist.Hint="Password" materialDesign:TextFieldAssist.TextBoxViewMargin="1 0 1 0" FontSize="20" Style="{StaticResource MaterialDesignFloatingHintPasswordBox}" AutomationProperties.IsRequiredForForm="True" />
</DockPanel>
+ <DockPanel Margin="0 40 0 0">
+ <materialDesign:PackIcon Margin="0 0 0 0" Width="20" Height="20" VerticalAlignment="Top" Foreground="{Binding ElementName=combo, Path=BorderBrush}" Kind="Settings" />
+ <ComboBox x:Name="combo" ItemsSource="{Binding Source={x:Type common:DeploymentSlots},Converter={StaticResource EnumToItemsSourceConverter}}" SelectedValue="{Binding DeploymentSlot}" SelectedValuePath="Value" DisplayMemberPath="Value" Margin="5 0 0 0" materialDesign:HintAssist.FloatingScale="0.50" materialDesign:HintAssist.Hint="Environment" materialDesign:TextFieldAssist.TextBoxViewMargin="1 0 1 0" FontSize="20" />
+ </DockPanel>
<CheckBox Margin="25 20 0 0" IsChecked="{Binding RememberMe}">Remember me</CheckBox>
</StackPanel>