Пример #1
0
        public async Task <IActionResult> ResetPassword(ResetPasswordViewModel model)
        {
            if (model == null)
            {
                throw new ArgumentNullException(nameof(model));
            }

            var user = await UserManagerAgent.FindByNameAsync(model.UserName).ConfigureAwait(false);

            IdentityResult result = await UserManagerAgent.ResetPasswordAsync(user, model.Token, model.Password).ConfigureAwait(false);

            if (result.Succeeded)
            {
                Success(_localizer["PasswordResetSuccess"], true);
                return(View("Login"));
            }
            else
            {
                Danger(_localizer["PasswordResetFail"]);
                return(View("RequestNewPassword"));
            }
        }