mirror of
https://github.com/bitwarden/server.git
synced 2025-07-01 08:02:49 -05:00
react to contact changes not being set from identity
This commit is contained in:
@ -73,7 +73,7 @@ namespace Bit.Core.Services
|
||||
|
||||
public async Task<User> GetUserByIdAsync(string userId)
|
||||
{
|
||||
if(_currentContext?.User != null &&
|
||||
if(_currentContext?.User != null &&
|
||||
string.Equals(_currentContext.User.Id.ToString(), userId, StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
return _currentContext.User;
|
||||
@ -100,6 +100,17 @@ namespace Bit.Core.Services
|
||||
return _currentContext.User;
|
||||
}
|
||||
|
||||
public async Task<User> GetUserByPrincipalAsync(ClaimsPrincipal principal)
|
||||
{
|
||||
var userId = GetProperUserId(principal);
|
||||
if(!userId.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return await GetUserByIdAsync(userId.Value);
|
||||
}
|
||||
|
||||
public async Task<DateTime> GetAccountRevisionDateByIdAsync(Guid userId)
|
||||
{
|
||||
return await _userRepository.GetAccountRevisionDateAsync(userId);
|
||||
|
Reference in New Issue
Block a user