From 0dec8a74239cff769836cae577fbd84824070e83 Mon Sep 17 00:00:00 2001 From: Roy Date: Sat, 21 Apr 2018 19:49:05 +0300 Subject: Implemented NavigationControl for better performance!!! Redesign of machine studio module initialization. --- .../ViewModels/LoginViewVM.cs | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs') 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 7fefe4a41..fafa752c5 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs @@ -41,6 +41,15 @@ namespace Tango.MachineStudio.UI.ViewModels set { _email = value; RaisePropertyChangedAuto(); } } + private String _password; + [Required(ErrorMessage = "Password is required")] + public String Password + { + get { return _password; } + set { _password = value; RaisePropertyChangedAuto(); } + } + + private bool _rememberMe; /// /// Gets or sets a value indicating whether to remember the last user email and password. @@ -54,7 +63,7 @@ namespace Tango.MachineStudio.UI.ViewModels /// /// Gets or sets the login command. /// - public RelayCommand LoginCommand { get; set; } + public RelayCommand LoginCommand { get; set; } /// /// Initializes a new instance of the class. @@ -68,29 +77,29 @@ namespace Tango.MachineStudio.UI.ViewModels _navigationManager = navigationManager; _authenticationProvider = authenticationProvider; _eventLogger = eventLogger; - LoginCommand = new RelayCommand(Login); + LoginCommand = new RelayCommand(Login); cryptographer = new Rfc2898Cryptographer(); Email = SettingsManager.Default.MachineStudio.LastLoginEmail; RememberMe = SettingsManager.Default.MachineStudio.RememberMe; + Password = cryptographer.Decrypt(SettingsManager.Default.MachineStudio.LastLoginPassword); } /// /// Logins the requested user. /// - /// The password. - private void Login(String password) + private void Login() { if (Validate()) { try { - _authenticationProvider.Login(Email, password); + _authenticationProvider.Login(Email, Password); _navigationManager.NavigateTo(NavigationView.MainView); SettingsManager.Default.MachineStudio.LastLoginEmail = Email; SettingsManager.Default.MachineStudio.RememberMe = RememberMe; - SettingsManager.Default.MachineStudio.LastLoginPassword = RememberMe ? cryptographer.Encrypt(password) : null; + SettingsManager.Default.MachineStudio.LastLoginPassword = RememberMe ? cryptographer.Encrypt(Password) : null; SettingsManager.SaveDefaultSettings(); _eventLogger.Log("User logged in"); -- cgit v1.3.1