Format ./web/backend/Features/Features.Auth

This commit is contained in:
Aaron Po
2026-06-20 15:09:40 -04:00
parent 254431928f
commit 79ae18b3e2
21 changed files with 189 additions and 146 deletions

View File

@@ -6,4 +6,4 @@ namespace Features.Auth.Commands.ResendConfirmationEmail;
/// Resends the account confirmation email to a user, generating a fresh confirmation token.
/// </summary>
/// <param name="UserId">The unique identifier of the user requesting the resend.</param>
public record ResendConfirmationEmailCommand(Guid UserId) : IRequest;
public record ResendConfirmationEmailCommand(Guid UserId) : IRequest;

View File

@@ -23,12 +23,17 @@ public class ResendConfirmationEmailHandler(
IMediator mediator
) : IRequestHandler<ResendConfirmationEmailCommand>
{
public async Task Handle(ResendConfirmationEmailCommand request, CancellationToken cancellationToken)
public async Task Handle(
ResendConfirmationEmailCommand request,
CancellationToken cancellationToken
)
{
UserAccount? user = await authRepository.GetUserByIdAsync(request.UserId);
if (user == null) return; // Silent return to prevent user enumeration
if (user == null)
return; // Silent return to prevent user enumeration
if (await authRepository.IsUserVerifiedAsync(request.UserId)) return; // Already confirmed, no-op
if (await authRepository.IsUserVerifiedAsync(request.UserId))
return; // Already confirmed, no-op
string confirmationToken = tokenService.GenerateConfirmationToken(user);
await mediator.Send(
@@ -36,4 +41,4 @@ public class ResendConfirmationEmailHandler(
cancellationToken
);
}
}
}