public async Task <IActionResult> RestorePassword([FromRoute] string userId, [FromBody] PasswordRestoreDto restoreDto)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            User user = await _accountBl.FindByIdAsync(userId);

            if (user == null)
            {
                return(BadRequest("There is no User with that ID "));
            }
            else
            {
                await _accountBl.ResetPasswordAsync(user, restoreDto);
            }
            return(Ok("Password restored successfully."));
        }
Example #2
0
 public async Task ResetPasswordAsync(User user, PasswordRestoreDto dto)
 {
     CheckIdentityResultUtil(await _userManager.ResetPasswordAsync(user, dto.RestoreToken, dto.NewPassword));
 }
Example #3
0
 /// <summary>
 /// Восстановление пароля от личного кабинета клиента.
 /// </summary>
 /// <param name="dto">Параметры восстановления пароля.</param>
 public BaseResponse PasswordRestore(PasswordRestoreDto dto) => Post <BaseResponse>("password/restore", dto);