コード例 #1
0
        public void ResetPassword(ResetPassword model, IBusinessErrorCollection errors)
        {
            if (!model.Validate(errors))
            {
                return;
            }

            var result = UserManager.PasswordValidator.ValidateAsync(model.Password).GetAwaiter().GetResult();
            if (!result.Succeeded)
            {
                errors.AddErrorsFromResult(result);
                return;
            }

            result = UserManager.ResetPassword(model.UserId, model.Code, model.Password);
            if (!result.Succeeded)
            {
                errors.AddErrorsFromResult(result);
                return;
            }
        }
コード例 #2
0
        public virtual ActionResult ResetPasswordPost(ResetPassword model)
        {
            return Handle(model, AccountService.ResetPassword,
                RedirectToAction(MVC.Accounts.Login()),
                RedirectToAction(MVC.Accounts.ResetPassword(model.UserId, model.Code)),
                "Password changed");

            return View(model);
        }