public static bool TryLogin(String username, SecureString securePassword) { bool successful = false; try { successful = UserHandler.VerifyPass(username, securePassword); if (successful) { _currentUser = username; } } catch (Exception e) { Console.WriteLine(e.Message); } return(successful); }
private void ChangePassword() { var current = PwbCurrentPass.SecurePassword; if (UserHandler.VerifyPass(LoginHandler.CurrentUser, current)) { var pass1 = PwbNewPass.SecurePassword; var pass2 = PwbPassConfirm.SecurePassword; if (Authenticator.MatchPasswords(pass1, pass2)) { UserHandler.SetPassword(LoginHandler.CurrentUser, pass1); MessageBox.Show("Password set!"); Close(); } else { MessageBox.Show("New passwords do not match."); } } else { MessageBox.Show("Current password is incorrect."); } }
public static UserList Refresh() { return(new UserList(UserHandler.GetXMLFile())); }
private void SetPass_Click(object sender, RoutedEventArgs e) { UserHandler.SetPassword("admin", TxbNewPass.SecurePassword); MessageBox.Show("Password set!"); TxbNewPass.Password = ""; // clear }