public ActionResult ChangePassword(ChangePasswordModel model) { if (ModelState.IsValid) { var user = GetUser(User.Identity.Name, model.CommandCompanyId); if (user != null && user.ValidatePassword(model.OldPassword)) { user.Update(model); RavenSession.SaveChanges(); return RedirectToAction("ChangePasswordSuccess"); } ModelState.AddModelError("", "The current password is incorrect or the new password is invalid."); } // If we got this far, something failed, redisplay form return View(model); }
public void Update(ChangePasswordModel command) { SetPassword(command.NewPassword); this.RegisterCommand(command); }