mirror of
https://github.com/bitwarden/server.git
synced 2025-05-24 04:51:03 -05:00
add logging to change password uri controller
This commit is contained in:
parent
d159067850
commit
5e23334a11
@ -8,22 +8,24 @@ namespace Bit.Icons.Controllers;
|
|||||||
[Route("change-password-uri")]
|
[Route("change-password-uri")]
|
||||||
public class ChangePasswordUriController : Controller
|
public class ChangePasswordUriController : Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
private readonly IMemoryCache _memoryCache;
|
private readonly IMemoryCache _memoryCache;
|
||||||
private readonly IDomainMappingService _domainMappingService;
|
private readonly IDomainMappingService _domainMappingService;
|
||||||
private readonly IChangePasswordUriService _changePasswordService;
|
private readonly IChangePasswordUriService _changePasswordService;
|
||||||
private readonly ChangePasswordUriSettings _changePasswordSettings;
|
private readonly ChangePasswordUriSettings _changePasswordSettings;
|
||||||
|
private readonly ILogger<ChangePasswordUriController> _logger;
|
||||||
|
|
||||||
public ChangePasswordUriController(
|
public ChangePasswordUriController(
|
||||||
IMemoryCache memoryCache,
|
IMemoryCache memoryCache,
|
||||||
IDomainMappingService domainMappingService,
|
IDomainMappingService domainMappingService,
|
||||||
IChangePasswordUriService changePasswordService,
|
IChangePasswordUriService changePasswordService,
|
||||||
ChangePasswordUriSettings iconsSettings)
|
ChangePasswordUriSettings iconsSettings,
|
||||||
|
ILogger<ChangePasswordUriController> logger)
|
||||||
{
|
{
|
||||||
_memoryCache = memoryCache;
|
_memoryCache = memoryCache;
|
||||||
_domainMappingService = domainMappingService;
|
_domainMappingService = domainMappingService;
|
||||||
_changePasswordService = changePasswordService;
|
_changePasswordService = changePasswordService;
|
||||||
_changePasswordSettings = iconsSettings;
|
_changePasswordSettings = iconsSettings;
|
||||||
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("config")]
|
[HttpGet("config")]
|
||||||
@ -62,6 +64,7 @@ public class ChangePasswordUriController : Controller
|
|||||||
var result = await _changePasswordService.GetChangePasswordUri(domain);
|
var result = await _changePasswordService.GetChangePasswordUri(domain);
|
||||||
if (result == null)
|
if (result == null)
|
||||||
{
|
{
|
||||||
|
_logger.LogWarning("Null result returned for {0}.", domain);
|
||||||
changePasswordUri = null;
|
changePasswordUri = null;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -71,6 +74,7 @@ public class ChangePasswordUriController : Controller
|
|||||||
|
|
||||||
if (_changePasswordSettings.CacheEnabled)
|
if (_changePasswordSettings.CacheEnabled)
|
||||||
{
|
{
|
||||||
|
_logger.LogInformation("Cache uri for {0}.", domain);
|
||||||
_memoryCache.Set(mappedDomain, changePasswordUri, new MemoryCacheEntryOptions
|
_memoryCache.Set(mappedDomain, changePasswordUri, new MemoryCacheEntryOptions
|
||||||
{
|
{
|
||||||
AbsoluteExpirationRelativeToNow = new TimeSpan(_changePasswordSettings.CacheHours, 0, 0),
|
AbsoluteExpirationRelativeToNow = new TimeSpan(_changePasswordSettings.CacheHours, 0, 0),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user