public void ChangePassword(String currentPW, String newPassword) // Change the password { if (VerifyPassword(currentPW)) { ModelUser.Password = Cryptography.Encrypt(newPassword); ModelUser.update(); MessageBox.Show("Sucessfull"); } }
public void resetPassword() { frmResetPassword recover = new frmResetPassword(userSensitiveData.Question); if (recover.ShowDialog() == System.Windows.Forms.DialogResult.OK) { if (Cryptography.Encrypt(recover.Answer).Equals(userSensitiveData.Answer)) { userSensitiveData.Password = Cryptography.Encrypt("1234"); userSensitiveData.update(); System.Windows.Forms.MessageBox.Show("Your password is reset to 1234.\r\nUse 1234 to login and change your password.", "Password Recovery", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); } else { System.Windows.Forms.MessageBox.Show("Your answer is wrong.", "Password Recovery", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation); } } }