Beispiel #1
0
        public ActionResult ChangePassword(ChangePasswordModel model)
        {
            var user = this.userManager.FindUserByUsername(model.Username);
            if (user == null)
            {
                return HttpNotFound();
            }

            if (ModelState.IsValid)
            {
                IdentityResult result = this.userManager.ChangePassword(user.Id, model.OldPassword, model.NewPassword);
                if (result.Succeeded)
                {
                    this.AddSuccessMessage("Password has been changed.");
                    return RedirectToRoute("admin.user_account.change_password_page");
                }

                ModelState.AddModelError(String.Empty, "Old password is not correct.");
            }

            return View(model);
        }
Beispiel #2
0
 public ActionResult ChangePassword()
 {
     var model = new ChangePasswordModel();
     return View(model);
 }