namespace IOL.GreatOffice.Api.Endpoints.Internal.PasswordResetRequests; /// public class FulfillResetRequestRoute : RouteBaseAsync.WithRequest.WithActionResult { private readonly ForgotPasswordService _forgotPasswordService; /// public FulfillResetRequestRoute(ForgotPasswordService forgotPasswordService) { _forgotPasswordService = forgotPasswordService; } /// /// Fulfill a password reset request. /// /// /// /// [AllowAnonymous] [HttpPost("~/_/forgot-password-requests/fulfill")] public override async Task HandleAsync(FulfillResetRequestPayload request, CancellationToken cancellationToken = default) { try { var fulfilled = await _forgotPasswordService.FullFillRequestAsync(request.Id, request.NewPassword, cancellationToken); return Ok(fulfilled); } catch (Exception e) { if (e is ForgotPasswordRequestNotFoundException or UserNotFoundException) { return NotFound(); } throw; } } }