| | | 1 | | using ArturRios.Heimdall.Shared.Messages; |
| | | 2 | | using FluentValidation; |
| | | 3 | | |
| | | 4 | | namespace ArturRios.Heimdall.Command.Input.Validation; |
| | | 5 | | |
| | | 6 | | /// <summary> |
| | | 7 | | /// Shape validation for <see cref="PasswordRecoveryCommand" /> (UC-12, NFR-10). Whether the |
| | | 8 | | /// address belongs to anyone is the handler's business, and it answers the same way either way |
| | | 9 | | /// (AF-12a). |
| | | 10 | | /// </summary> |
| | | 11 | | /// <remarks> |
| | | 12 | | /// UC-12 lists no validation alternative flow, but NFR-10 requires every input to be validated, |
| | | 13 | | /// so a missing or malformed address is refused as a bad request before any lookup runs. That |
| | | 14 | | /// costs nothing in enumeration terms: a caller learns their own address is malformed, never |
| | | 15 | | /// whether it is registered. |
| | | 16 | | /// </remarks> |
| | | 17 | | public class PasswordRecoveryCommandValidator : AbstractValidator<PasswordRecoveryCommand> |
| | | 18 | | { |
| | 35 | 19 | | public PasswordRecoveryCommandValidator() |
| | | 20 | | { |
| | 35 | 21 | | RuleFor(command => command.Email) |
| | 35 | 22 | | .NotEmpty().WithMessage(AuthMessages.EmailRequired) |
| | 35 | 23 | | .EmailAddress().WithMessage(AuthMessages.EmailInvalid); |
| | 35 | 24 | | } |
| | | 25 | | } |