| | | 1 | | using ArturRios.Heimdall.Shared.Security; |
| | | 2 | | using ArturRios.Heimdall.Command.Services; |
| | | 3 | | |
| | | 4 | | namespace ArturRios.Heimdall.WebApi.Email; |
| | | 5 | | |
| | | 6 | | /// <summary> |
| | | 7 | | /// Fallback <see cref="IEmailVerificationSender" /> for environments without Mailgun |
| | | 8 | | /// credentials: logs the recipient and token instead of delivering a real email. Registered in |
| | | 9 | | /// place of <see cref="MailgunEmailVerificationSender" /> when |
| | | 10 | | /// <see cref="EmailDeliveryOptions.MailgunConfigured" /> is false — which is how the functional |
| | | 11 | | /// suite stays off the network. |
| | | 12 | | /// </summary> |
| | 133 | 13 | | public class LoggingEmailVerificationSender(ILogger<LoggingEmailVerificationSender> logger) |
| | | 14 | | : IEmailVerificationSender |
| | | 15 | | { |
| | | 16 | | public Task SendAsync(string email, string token, string? linkBase) |
| | | 17 | | { |
| | 25 | 18 | | logger.LogInformation( |
| | 25 | 19 | | "Email verification token issued for {EmailRef}: {Token} (link base: {LinkBase})", |
| | 25 | 20 | | LogSafeEmail.Reference(email), token, string.IsNullOrWhiteSpace(linkBase) ? "global" : "scope"); |
| | | 21 | | |
| | 25 | 22 | | return Task.CompletedTask; |
| | | 23 | | } |
| | | 24 | | } |