public async Task <IActionResult> ResetPassword([FromBody] ResetUserPasswordDto resetUserPasswordDto) { var user = await _userManager.FindByIdAsync(resetUserPasswordDto.UserId); if (user == null) { return(NotFound("User with this id was not found")); } var resetPassResult = await _userManager.ResetPasswordAsync(user, resetUserPasswordDto.Token, resetUserPasswordDto.NewPassword); if (!resetPassResult.Succeeded) { return(BadRequest(resetPassResult.Errors)); } return(Ok(_mapper.Map <User, UserDto>(user))); }
public async Task <IActionResult> ResetPassword(String token, ResetUserPasswordDto dto) { return(Ok( await _mediator.Send(new ResetUserPasswordCommand(token, dto)) )); }
public ResetUserPasswordCommand(String token, ResetUserPasswordDto dto) { Token = token; Dto = dto; }