mirror of
https://github.com/bitwarden/server.git
synced 2025-04-06 05:28:15 -05:00
Early return default on null user (#1645)
Clearly, no known device exists for an unknown user.
This commit is contained in:
parent
18006591fc
commit
5b1d8c723a
@ -474,9 +474,15 @@ namespace Bit.Core.IdentityServer
|
|||||||
protected async Task<bool> KnownDeviceAsync(User user, ValidatedTokenRequest request) =>
|
protected async Task<bool> KnownDeviceAsync(User user, ValidatedTokenRequest request) =>
|
||||||
(await GetKnownDeviceAsync(user, request)) != default;
|
(await GetKnownDeviceAsync(user, request)) != default;
|
||||||
|
|
||||||
protected async Task<Device> GetKnownDeviceAsync(User user, ValidatedTokenRequest request) =>
|
protected async Task<Device> GetKnownDeviceAsync(User user, ValidatedTokenRequest request)
|
||||||
await _deviceRepository.GetByIdentifierAsync(GetDeviceFromRequest(request).Identifier, user.Id);
|
{
|
||||||
|
if (user == null)
|
||||||
|
{
|
||||||
|
return default;
|
||||||
|
}
|
||||||
|
|
||||||
|
return await _deviceRepository.GetByIdentifierAsync(GetDeviceFromRequest(request).Identifier, user.Id);
|
||||||
|
}
|
||||||
private async Task<Device> SaveDeviceAsync(User user, ValidatedTokenRequest request)
|
private async Task<Device> SaveDeviceAsync(User user, ValidatedTokenRequest request)
|
||||||
{
|
{
|
||||||
var device = GetDeviceFromRequest(request);
|
var device = GetDeviceFromRequest(request);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user