public bool ChangePassword(string userName, string oldpassword, string newPassword1, string newPassword2) { bool changedPassword; //Verifies that the account and old password are valid if (userLoginSQLDAO.CheckLogin(userName, oldpassword)) { //Verifies that password matches and meets criteria if (ValidPassword(newPassword1, newPassword2)) { changedPassword = true; //Once verified it will change the password userLoginSQLDAO.ChangeLoginPassword(userName, newPassword1); } else { changedPassword = false; } } else { changedPassword = false; } return(changedPassword); }
public void ChangeLoginPasswordTest() { dao.ChangeLoginPassword("testuser", "NewPassword"); Assert.AreEqual(true, dao.CheckLogin("testuser", "NewPassword")); Assert.AreEqual(false, dao.CheckLogin("testuser", "password")); }