Esempio n. 1
0
 public bool ChangePassword(ChangePasswordCommand changePasswordCommand)
 {
     return 0 == commandBus.Execute(changePasswordCommand);
 }
Esempio n. 2
0
        public ActionResult ChangePassword(string newPassword, string currentPassword, string confirmPassword)
        {
            ViewData["PasswordLength"] = membershipReadModel.MinPasswordLength;

            if (!ValidateChangePassword(currentPassword, newPassword, confirmPassword))
            {
                return View();
            }

            try
            {
                var userId = ((NerdIdentity)User.Identity).UserId;
                var changePasswordCommand = new ChangePasswordCommand{NewPassword = newPassword, UserId = userId};
                if(commandService.ChangePassword(changePasswordCommand))
                    return RedirectToAction("ChangePasswordSuccess");

                ModelState.AddModelError("_FORM", "The current password is incorrect or the new password is invalid.");
                return View();
            }
            catch
            {
                ModelState.AddModelError("_FORM", "The current password is incorrect or the new password is invalid.");
                return View();
            }
        }