From 5e23334a117a5095496fe1d33c24a3a60c61dfae Mon Sep 17 00:00:00 2001 From: Nick Krantz Date: Tue, 20 May 2025 10:09:53 -0500 Subject: [PATCH] add logging to change password uri controller --- src/Icons/Controllers/ChangePasswordUriController.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Icons/Controllers/ChangePasswordUriController.cs b/src/Icons/Controllers/ChangePasswordUriController.cs index 28006cd136..495e9adc22 100644 --- a/src/Icons/Controllers/ChangePasswordUriController.cs +++ b/src/Icons/Controllers/ChangePasswordUriController.cs @@ -8,22 +8,24 @@ namespace Bit.Icons.Controllers; [Route("change-password-uri")] public class ChangePasswordUriController : Controller { - private readonly IMemoryCache _memoryCache; private readonly IDomainMappingService _domainMappingService; private readonly IChangePasswordUriService _changePasswordService; private readonly ChangePasswordUriSettings _changePasswordSettings; + private readonly ILogger _logger; public ChangePasswordUriController( IMemoryCache memoryCache, IDomainMappingService domainMappingService, IChangePasswordUriService changePasswordService, - ChangePasswordUriSettings iconsSettings) + ChangePasswordUriSettings iconsSettings, + ILogger logger) { _memoryCache = memoryCache; _domainMappingService = domainMappingService; _changePasswordService = changePasswordService; _changePasswordSettings = iconsSettings; + _logger = logger; } [HttpGet("config")] @@ -62,6 +64,7 @@ public class ChangePasswordUriController : Controller var result = await _changePasswordService.GetChangePasswordUri(domain); if (result == null) { + _logger.LogWarning("Null result returned for {0}.", domain); changePasswordUri = null; } else @@ -71,6 +74,7 @@ public class ChangePasswordUriController : Controller if (_changePasswordSettings.CacheEnabled) { + _logger.LogInformation("Cache uri for {0}.", domain); _memoryCache.Set(mappedDomain, changePasswordUri, new MemoryCacheEntryOptions { AbsoluteExpirationRelativeToNow = new TimeSpan(_changePasswordSettings.CacheHours, 0, 0),