| | | 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="ITwoFactorEmailSender" /> for environments without Mailgun credentials: |
| | | 8 | | /// logs the recipient and code instead of delivering a real email. Registered in place of |
| | | 9 | | /// <see cref="MailgunTwoFactorEmailSender" /> when |
| | | 10 | | /// <see cref="EmailDeliveryOptions.MailgunConfigured" /> is false. |
| | | 11 | | /// </summary> |
| | 159 | 12 | | public class LoggingTwoFactorEmailSender(ILogger<LoggingTwoFactorEmailSender> logger) |
| | | 13 | | : ITwoFactorEmailSender |
| | | 14 | | { |
| | | 15 | | public Task SendAsync(string email, string code) |
| | | 16 | | { |
| | 36 | 17 | | logger.LogInformation("Two-factor email code issued for {EmailRef}: {Code}", LogSafeEmail.Reference(email), code |
| | | 18 | | |
| | 36 | 19 | | return Task.CompletedTask; |
| | | 20 | | } |
| | | 21 | | } |