| | | 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="IPasswordResetSender" /> for environments without Mailgun credentials: |
| | | 8 | | /// logs the recipient and token instead of delivering a real email. Registered in place of |
| | | 9 | | /// <see cref="MailgunPasswordResetSender" /> when |
| | | 10 | | /// <see cref="EmailDeliveryOptions.MailgunConfigured" /> is false. |
| | | 11 | | /// </summary> |
| | 38 | 12 | | public class LoggingPasswordResetSender(ILogger<LoggingPasswordResetSender> logger) |
| | | 13 | | : IPasswordResetSender |
| | | 14 | | { |
| | | 15 | | public Task SendAsync(string email, string token, string? linkBase) |
| | | 16 | | { |
| | 23 | 17 | | logger.LogInformation( |
| | 23 | 18 | | "Password reset token issued for {EmailRef}: {Token} (link base: {LinkBase})", |
| | 23 | 19 | | LogSafeEmail.Reference(email), token, string.IsNullOrWhiteSpace(linkBase) ? "global" : "scope"); |
| | | 20 | | |
| | 23 | 21 | | return Task.CompletedTask; |
| | | 22 | | } |
| | | 23 | | } |