diff options
| author | ivarlovlie <git@ivarlovlie.no> | 2022-06-05 00:19:10 +0200 |
|---|---|---|
| committer | ivarlovlie <git@ivarlovlie.no> | 2022-06-05 00:19:10 +0200 |
| commit | 1bd30ee34323f150c63fc537e0d131dca29dc4ef (patch) | |
| tree | 12f8315916537bd4c9692a2d220a819e78a892fb /server/src/Services/ForgotPasswordService.cs | |
| parent | d46743d565461144e1aabfb4b6a297d8387c4075 (diff) | |
| download | greatoffice-1bd30ee34323f150c63fc537e0d131dca29dc4ef.tar.xz greatoffice-1bd30ee34323f150c63fc537e0d131dca29dc4ef.zip | |
refactor: Implement caching in VaultService and use VaultService instead of IOptions
Diffstat (limited to 'server/src/Services/ForgotPasswordService.cs')
| -rw-r--r-- | server/src/Services/ForgotPasswordService.cs | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/server/src/Services/ForgotPasswordService.cs b/server/src/Services/ForgotPasswordService.cs index e6b6acf..6874d37 100644 --- a/server/src/Services/ForgotPasswordService.cs +++ b/server/src/Services/ForgotPasswordService.cs @@ -1,23 +1,21 @@ -using Microsoft.Extensions.Options; - namespace IOL.GreatOffice.Api.Services; public class ForgotPasswordService { private readonly AppDbContext _context; private readonly MailService _mailService; - private readonly IOptions<AppConfiguration> _configuration; + private readonly AppConfiguration _configuration; private readonly ILogger<ForgotPasswordService> _logger; public ForgotPasswordService( AppDbContext context, - IOptions<AppConfiguration> configuration, + VaultService vaultService, ILogger<ForgotPasswordService> logger, MailService mailService ) { _context = context; - _configuration = configuration; + _configuration = vaultService.GetCurrentAppConfiguration(); _logger = logger; _mailService = mailService; } @@ -59,9 +57,9 @@ public class ForgotPasswordService var request = new ForgotPasswordRequest(user); _context.ForgotPasswordRequests.Add(request); await _context.SaveChangesAsync(cancellationToken); - var portalUrl = _configuration.Value.PORTAL_URL; - var emailFromAddress = _configuration.Value.EMAIL_FROM_ADDRESS; - var emailFromDisplayName = _configuration.Value.EMAIL_FROM_DISPLAY_NAME; + var portalUrl = _configuration.PORTAL_URL; + var emailFromAddress = _configuration.EMAIL_FROM_ADDRESS; + var emailFromDisplayName = _configuration.EMAIL_FROM_DISPLAY_NAME; var zonedExpirationDate = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(request.ExpirationDate, requestTz.Id); var message = new MailMessage { From = new MailAddress(emailFromAddress, emailFromDisplayName), |
