mirror of
https://github.com/bitwarden/server.git
synced 2025-07-04 17:42:49 -05:00
Allow bypass of captcha token if the device is known (#1626)
This commit is contained in:
@ -471,12 +471,18 @@ namespace Bit.Core.IdentityServer
|
||||
}
|
||||
}
|
||||
|
||||
protected async Task<bool> KnownDeviceAsync(User user, ValidatedTokenRequest request) =>
|
||||
(await GetKnownDeviceAsync(user, request)) != default;
|
||||
|
||||
protected async Task<Device> GetKnownDeviceAsync(User user, ValidatedTokenRequest request) =>
|
||||
await _deviceRepository.GetByIdentifierAsync(GetDeviceFromRequest(request).Identifier, user.Id);
|
||||
|
||||
private async Task<Device> SaveDeviceAsync(User user, ValidatedTokenRequest request)
|
||||
{
|
||||
var device = GetDeviceFromRequest(request);
|
||||
if (device != null)
|
||||
{
|
||||
var existingDevice = await _deviceRepository.GetByIdentifierAsync(device.Identifier, user.Id);
|
||||
var existingDevice = await GetKnownDeviceAsync(user, request);
|
||||
if (existingDevice == null)
|
||||
{
|
||||
device.UserId = user.Id;
|
||||
|
Reference in New Issue
Block a user