private void SetPassword(object pass) { if (pass is SecureString) { UserHandler.SetPassword("admin", (SecureString)pass); } }
private void Reset() { string pass = "******"; SecureString defaultPass = new SecureString(); Array.ForEach(pass.ToArray(), defaultPass.AppendChar); UserHandler.SetPassword(_username, defaultPass); MessageBox.Show("Password reset"); }
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."); } }
private void SetPass_Click(object sender, RoutedEventArgs e) { UserHandler.SetPassword("admin", TxbNewPass.SecurePassword); MessageBox.Show("Password set!"); TxbNewPass.Password = ""; // clear }