public override bool ChangePassword(string username, string oldPassword, string newPassword) { try { if (username == _UserStorage.GetCurrentUser().Username) { _UserStorage.ChangePassword(new ChangePasswordModel { NewPassword = newPassword, OldPassword = oldPassword }); return(true); } } catch (Exception) { } return(false); }
public ActionResult ChangePassword(ChangePasswordModel changePasswordModel) { if (changePasswordModel.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")); }
public async Task <OperationResult> ChangePassword(ChangePasswordVM changePasswordVM) { await _userStorage.ChangePassword(changePasswordVM); return(OperationResult.Success); }