diff --git a/src/App/Pages/Accounts/LockPageViewModel.cs b/src/App/Pages/Accounts/LockPageViewModel.cs index 0a4d58c29..d8e620af0 100644 --- a/src/App/Pages/Accounts/LockPageViewModel.cs +++ b/src/App/Pages/Accounts/LockPageViewModel.cs @@ -38,7 +38,7 @@ namespace Bit.App.Pages private string _masterPassword; private string _pin; private bool _showPassword; - private PinLockEnum _pinStatus; + private PinLockType _pinStatus; private bool _pinEnabled; private bool _biometricEnabled; private bool _biometricIntegrityValid = true; @@ -165,8 +165,8 @@ namespace Bit.App.Pages var ephemeralPinSet = await _stateService.GetUserKeyPinEphemeralAsync() ?? await _stateService.GetPinProtectedKeyAsync(); - PinEnabled = (_pinStatus == PinLockEnum.Transient && ephemeralPinSet != null) || - _pinStatus == PinLockEnum.Persistent; + PinEnabled = (_pinStatus == PinLockType.Transient && ephemeralPinSet != null) || + _pinStatus == PinLockType.Persistent; BiometricEnabled = await _vaultTimeoutService.IsBiometricLockSetAsync() && await _cryptoService.HasEncryptedUserKeyAsync(); @@ -257,13 +257,13 @@ namespace Bit.App.Pages { EncString userKeyPin = null; EncString oldPinProtected = null; - if (_pinStatus == PinLockEnum.Persistent) + if (_pinStatus == PinLockType.Persistent) { userKeyPin = await _stateService.GetUserKeyPinAsync(); var oldEncryptedKey = await _stateService.GetPinProtectedAsync(); oldPinProtected = oldEncryptedKey != null ? new EncString(oldEncryptedKey) : null; } - else if (_pinStatus == PinLockEnum.Transient) + else if (_pinStatus == PinLockType.Transient) { userKeyPin = await _stateService.GetUserKeyPinEphemeralAsync(); oldPinProtected = await _stateService.GetPinProtectedKeyAsync(); @@ -273,7 +273,7 @@ namespace Bit.App.Pages if (oldPinProtected != null) { userKey = await _cryptoService.DecryptAndMigrateOldPinKeyAsync( - _pinStatus == PinLockEnum.Transient, + _pinStatus == PinLockType.Transient, Pin, _email, kdfConfig, diff --git a/src/App/Pages/Settings/SettingsPage/SettingsPageViewModel.cs b/src/App/Pages/Settings/SettingsPage/SettingsPageViewModel.cs index 1875405c8..d2f80eca1 100644 --- a/src/App/Pages/Settings/SettingsPage/SettingsPageViewModel.cs +++ b/src/App/Pages/Settings/SettingsPage/SettingsPageViewModel.cs @@ -139,7 +139,7 @@ namespace Bit.App.Pages } var pinSet = await _vaultTimeoutService.IsPinLockSetAsync(); - _pin = pinSet != PinLockEnum.Disabled; + _pin = pinSet != PinLockType.Disabled; _biometric = await _vaultTimeoutService.IsBiometricLockSetAsync(); _screenCaptureAllowed = await _stateService.GetScreenCaptureAllowedAsync(); diff --git a/src/Core/Abstractions/IVaultTimeoutService.cs b/src/Core/Abstractions/IVaultTimeoutService.cs index 529806983..daf4865d2 100644 --- a/src/Core/Abstractions/IVaultTimeoutService.cs +++ b/src/Core/Abstractions/IVaultTimeoutService.cs @@ -17,7 +17,7 @@ namespace Bit.Core.Abstractions Task ShouldLockAsync(string userId = null); Task IsLoggedOutByTimeoutAsync(string userId = null); Task ShouldLogOutByTimeoutAsync(string userId = null); - Task IsPinLockSetAsync(string userId = null); + Task IsPinLockSetAsync(string userId = null); Task IsBiometricLockSetAsync(string userId = null); Task LockAsync(bool allowSoftLock = false, bool userInitiated = false, string userId = null); Task LogOutAsync(bool userInitiated = true, string userId = null); diff --git a/src/Core/Services/VaultTimeoutService.cs b/src/Core/Services/VaultTimeoutService.cs index f1060c2e1..920cba716 100644 --- a/src/Core/Services/VaultTimeoutService.cs +++ b/src/Core/Services/VaultTimeoutService.cs @@ -1,13 +1,11 @@ using System; -using System.Linq; using System.Threading.Tasks; using Bit.Core.Abstractions; using Bit.Core.Enums; -using Bit.Core.Models.Domain; namespace Bit.Core.Services { - public enum PinLockEnum + public enum PinLockType { Disabled, Persistent, @@ -175,8 +173,8 @@ namespace Bit.Core.Services var pinStatus = await IsPinLockSetAsync(userId); var ephemeralPinSet = await _stateService.GetUserKeyPinEphemeralAsync() ?? await _stateService.GetPinProtectedKeyAsync(); - var pinEnabled = (pinStatus == PinLockEnum.Transient && ephemeralPinSet != null) || - pinStatus == PinLockEnum.Persistent; + var pinEnabled = (pinStatus == PinLockType.Transient && ephemeralPinSet != null) || + pinStatus == PinLockType.Persistent; if (!pinEnabled && !await IsBiometricLockSetAsync()) { @@ -227,7 +225,7 @@ namespace Bit.Core.Services await _tokenService.ToggleTokensAsync(); } - public async Task IsPinLockSetAsync(string userId = null) + public async Task IsPinLockSetAsync(string userId = null) { // we can't depend on only the protected pin being set because old // versions only used it for MP on Restart @@ -237,15 +235,15 @@ namespace Bit.Core.Services if (userKeyPin != null || oldUserKeyPin != null) { - return PinLockEnum.Persistent; + return PinLockType.Persistent; } else if (pinIsEnabled != null && userKeyPin == null && oldUserKeyPin == null) { - return PinLockEnum.Transient; + return PinLockType.Transient; } else { - return PinLockEnum.Disabled; + return PinLockType.Disabled; } }