Exemplo n.º 1
0
        public ActionResult ResetPassword(string username, string token)
        {
            if (!_accountService.ConfirmUserFromToken(username, token))
            {
                return(RedirectToAction("ResetPasswordFailed"));
            }

            var model = new UserAccount.ResetPasswordModel
            {
                UserName = username,
                Token    = token
            };

            return(View(model));
        }
Exemplo n.º 2
0
        public ActionResult ResetPassword(UserAccount.ResetPasswordModel model)
        {
            if (ModelState.IsValid)
            {
                var result = _accountService.ResetPassword(model);
                if (result.IsSuccess)
                {
                    return(RedirectToAction("ResetPasswordSuccess"));
                }

                foreach (var registrationError in result.Errors)
                {
                    ModelState.AddModelError(registrationError.FieldName, registrationError.ErrorMessage);
                }
            }

            return(View(model));
        }