1
0
mirror of https://github.com/bitwarden/server.git synced 2025-02-16 01:51:21 +01:00

Use a user-based known device check (#2318)

This commit is contained in:
Addison Beck 2022-09-30 09:45:07 -04:00 committed by GitHub
parent 13e33cd789
commit c8783ced6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -91,8 +91,8 @@ public class AuthRequestsController : Controller
}
if (_globalSettings.PasswordlessAuth.KnownDevicesOnly)
{
var d = await _deviceRepository.GetByIdentifierAsync(model.DeviceIdentifier);
if (d == null || d.UserId != user.Id)
var devices = await _deviceRepository.GetManyByUserIdAsync(user.Id);
if (devices == null || !devices.Any(d => d.Identifier == model.DeviceIdentifier))
{
throw new NotFoundException();
}