namespace IOL.GreatOffice.Api.Endpoints.Internal.PasswordResetRequests; public class IsResetRequestValidRoute : RouteBaseAsync.WithRequest.WithActionResult { private readonly PasswordResetService _passwordResetService; public IsResetRequestValidRoute(PasswordResetService passwordResetService) { _passwordResetService = passwordResetService; } /// /// Check if a given password reset request is still valid. /// /// /// /// [AllowAnonymous] [HttpGet("~/_/password-reset-request/is-valid")] public override async Task HandleAsync(Guid id, CancellationToken cancellationToken = default) { var request = await _passwordResetService.GetRequestAsync(id, cancellationToken); if (request == default) { return NotFound(); } return Ok(request.IsExpired == false); } }