Exemple #1
0
        public async Task <string> ResetPassword(ResetPasswordAccountViewModel model)
        {
            var userId = HttpUtility.UrlDecode(model.UserId);
            var user   = await _userManager.FindByIdAsync(userId);

            Require.Objects.NotNull <NotFoundException>(user, $"User not found");

            var validCode = model.Code.Replace(" ", "+").Replace("%20", "+");
            var result    = await _userManager.ResetPasswordAsync(user, validCode, model.Password);

            if (!result.Succeeded)
            {
                throw new BadRequestException(result.GetErrors());
            }

            return($"{_appSettings.FrontEndUrl}account/signIn");
        }
Exemple #2
0
        public async Task <IActionResult> ResetPassoword([FromBody] ResetPasswordAccountViewModel model)
        {
            var returnUrl = await _accountService.ResetPassword(model);

            return(Redirect(returnUrl));
        }