1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-20 02:48:03 -05:00
This commit is contained in:
Bernd Schoolmann 2025-06-05 20:34:25 +02:00
parent 5ff9f856a2
commit 2428d64488
No known key found for this signature in database

View File

@ -18,12 +18,7 @@ public class UsersController(
public async Task<UserKeyResponseModel> GetPublicKeyAsync(string id) public async Task<UserKeyResponseModel> GetPublicKeyAsync(string id)
{ {
var guidId = new Guid(id); var guidId = new Guid(id);
var key = await _userRepository.GetPublicKeyAsync(guidId); var key = await _userRepository.GetPublicKeyAsync(guidId) ?? throw new NotFoundException();
if (key == null)
{
throw new NotFoundException();
}
return new UserKeyResponseModel(guidId, key); return new UserKeyResponseModel(guidId, key);
} }
@ -31,17 +26,8 @@ public class UsersController(
public async Task<PublicKeysResponseModel> GetAccountKeysAsync(string id) public async Task<PublicKeysResponseModel> GetAccountKeysAsync(string id)
{ {
var guidId = new Guid(id); var guidId = new Guid(id);
var user = await _userRepository.GetByIdAsync(guidId); var user = await _userRepository.GetByIdAsync(guidId) ?? throw new NotFoundException();
if (user == null) var accountKeys = await _userAccountKeysQuery.Run(user) ?? throw new NotFoundException("User account keys not found.");
{
throw new NotFoundException();
}
var accountKeys = await _userAccountKeysQuery.Run(user);
if (accountKeys == null)
{
throw new NotFoundException("User account keys not found.");
}
return new PublicKeysResponseModel(accountKeys); return new PublicKeysResponseModel(accountKeys);
} }
} }