aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs')
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs49
1 files changed, 45 insertions, 4 deletions
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 7fa79984b..e7a32d107 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs
@@ -25,6 +25,8 @@ using Tango.Web;
using SimpleValidator.Extensions;
using Tango.BL.Entities;
using System.Data.Entity;
+using Tango.MachineStudio.Common.Buid;
+using System.Diagnostics;
namespace Tango.MachineStudio.UI.ViewModels
{
@@ -42,6 +44,7 @@ namespace Tango.MachineStudio.UI.ViewModels
private MachineStudioSettings _settings;
private MachineStudioWebClient _machineStudioWebClient;
private TaskCompletionSource<object> _updatePasswordCompletionSource;
+ private IBuildProvider _buildProvider;
private String _email;
/// <summary>
@@ -66,6 +69,17 @@ namespace Tango.MachineStudio.UI.ViewModels
set { _password = value; RaisePropertyChangedAuto(); }
}
+ private String _serialNumber;
+ /// <summary>
+ /// Gets or sets the password.
+ /// </summary>
+ [Required(ErrorMessage = "Serial Number is required")]
+ public String SerialNumber
+ {
+ get { return _serialNumber; }
+ set { _serialNumber = value; RaisePropertyChangedAuto(); }
+ }
+
private DeploymentSlot _deploymentSlot;
/// <summary>
/// Gets or sets the deployment slot.
@@ -156,6 +170,8 @@ namespace Tango.MachineStudio.UI.ViewModels
set { _newPassword2 = value; RaisePropertyChangedAuto(); }
}
+ public List<DeploymentSlot> Environments { get; set; }
+
/// <summary>
/// Gets or sets the login command.
/// </summary>
@@ -172,24 +188,42 @@ namespace Tango.MachineStudio.UI.ViewModels
/// <param name="authenticationProvider">The authentication provider.</param>
/// <param name="navigationManager">The navigation manager.</param>
/// <param name="notificationProvider">The notification provider.</param>
- public LoginViewVM(MachineStudioWebClient machineStudioWebClient, IAuthenticationProvider authenticationProvider, INavigationManager navigationManager, INotificationProvider notificationProvider, IEventLogger eventLogger)
+ public LoginViewVM(IBuildProvider buildProvider, MachineStudioWebClient machineStudioWebClient, IAuthenticationProvider authenticationProvider, INavigationManager navigationManager, INotificationProvider notificationProvider, IEventLogger eventLogger)
{
EnableSlotSelection = true;
ShowLoggingDetails = true;
_machineStudioWebClient = machineStudioWebClient;
+ _buildProvider = buildProvider;
_settings = SettingsManager.Default.GetOrCreate<MachineStudioSettings>();
+ if (_buildProvider.BuildType == MSBuildType.Default)
+ {
+ Environments = Enum.GetValues(typeof(DeploymentSlot)).Cast<DeploymentSlot>().ToList();
+ }
+ else
+ {
+ Environments = new List<DeploymentSlot>();
+
+ Environments.Add(DeploymentSlot.DEV);
+ Environments.Add(DeploymentSlot.TEST);
+ Environments.Add(DeploymentSlot.BETA);
+ Environments.Add(DeploymentSlot.PROD);
+ }
+
_notificationProvider = notificationProvider;
_navigationManager = navigationManager;
_authenticationProvider = authenticationProvider;
+ _buildProvider = buildProvider;
_eventLogger = eventLogger;
LoginCommand = new RelayCommand(Login, () => !IsLogging);
UpdatePasswordCommand = new RelayCommand(UpdatePassword, () => IsChangingPassword);
cryptographer = new Rfc2898Cryptographer();
Email = _settings.LastLoginEmail;
+ SerialNumber = _settings.LastLoginSerialNumber;
DeploymentSlot = _settings.DeploymentSlot;
+
RememberMe = _settings.RememberMe;
if (_settings.LastLoginMethod == LoginMethod.ActiveDirectory)
@@ -201,6 +235,12 @@ namespace Tango.MachineStudio.UI.ViewModels
IsStandardUser = true;
}
+ if (_buildProvider.BuildType == MSBuildType.Lite)
+ {
+ IsStandardUser = true;
+ }
+
+
try
{
Password = cryptographer.Decrypt(_settings.LastLoginPassword);
@@ -236,7 +276,7 @@ namespace Tango.MachineStudio.UI.ViewModels
LoginResponse result = _authenticationProvider.Login(Email, Password, loginMethod, _settings.ByPassEnvironmentVersionCheck, (progress) =>
{
ProgressLog = progress;
- }).Response;
+ }, SerialNumber).Response;
if (result.VersionChangeRequired && !_settings.ByPassEnvironmentVersionCheck)
{
@@ -271,6 +311,7 @@ namespace Tango.MachineStudio.UI.ViewModels
_settings.RememberMe = RememberMe;
_settings.LastLoginMethod = loginMethod;
_settings.LastLoginPassword = RememberMe ? cryptographer.Encrypt(Password) : null;
+ _settings.LastLoginSerialNumber = SerialNumber;
_settings.Save();
EnableSlotSelection = false;
@@ -280,11 +321,11 @@ namespace Tango.MachineStudio.UI.ViewModels
IsChangingPassword = false;
InvalidateRelayCommands();
- InvokeUI(() =>
+ InvokeUI(() =>
{
MainWindow.Instance.Title += $" - {_settings.DeploymentSlot}";
});
-
+
});
}
catch (Exception ex)