public override bool ValidateUser(string username, string password) { var user = _UserStorage.GetUser(u => u.Username == username && u.Password == _UserStorage.EncryptPassword(password)); return(user != null && !user.Deleted); }
public ActionResult ChangePassword(ChangePasswordModel changePasswordModel) { var oldPassword = _Storage.EncryptPassword(changePasswordModel.OldPassword); if (oldPassword != _Storage.GetCurrentUser().Password) { ModelState.AddModelError("OldPassword", "Pasword is not correct"); } else if (changePasswordModel.NewPassword != changePasswordModel.ConfirmPassword) { ModelState.AddModelError("ConfirmPassword", "Paswords don't match"); } if (!ModelState.IsValid) { return(View()); } _Storage.ChangePassword(changePasswordModel); return(RedirectToAction("Index")); }