mirror of
https://github.com/bitwarden/android.git
synced 2024-12-25 18:38:27 +03:00
[PM-3547] Change logic to set user key for inactive account (#2715)
This commit is contained in:
parent
47be3d6aef
commit
68759fc608
1 changed files with 4 additions and 8 deletions
|
@ -59,13 +59,6 @@ namespace Bit.Core.Services
|
||||||
|
|
||||||
public async Task<bool> IsLockedAsync(string userId = null)
|
public async Task<bool> IsLockedAsync(string userId = null)
|
||||||
{
|
{
|
||||||
// When checking if we need to lock inactive account, we don't want to
|
|
||||||
// set the key, so we only check if the account has an auto unlock key
|
|
||||||
if (userId != null && await _stateService.GetActiveUserIdAsync() != userId)
|
|
||||||
{
|
|
||||||
return await _cryptoService.HasAutoUnlockKeyAsync(userId);
|
|
||||||
}
|
|
||||||
|
|
||||||
var biometricSet = await IsBiometricLockSetAsync(userId);
|
var biometricSet = await IsBiometricLockSetAsync(userId);
|
||||||
if (biometricSet && await _stateService.GetBiometricLockedAsync(userId))
|
if (biometricSet && await _stateService.GetBiometricLockedAsync(userId))
|
||||||
{
|
{
|
||||||
|
@ -78,8 +71,11 @@ namespace Bit.Core.Services
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if (userId != null && await _stateService.GetActiveUserIdAsync() != userId)
|
||||||
|
{
|
||||||
await _cryptoService.SetUserKeyAsync(await _cryptoService.GetAutoUnlockKeyAsync(userId), userId);
|
await _cryptoService.SetUserKeyAsync(await _cryptoService.GetAutoUnlockKeyAsync(userId), userId);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Check again to verify auto key was set
|
// Check again to verify auto key was set
|
||||||
var hasKey = await _cryptoService.HasUserKeyAsync(userId);
|
var hasKey = await _cryptoService.HasUserKeyAsync(userId);
|
||||||
|
|
Loading…
Reference in a new issue