diff --git a/src/App/Abstractions/IPasswordRepromptService.cs b/src/App/Abstractions/IPasswordRepromptService.cs index 31323f1b3..47fc5930d 100644 --- a/src/App/Abstractions/IPasswordRepromptService.cs +++ b/src/App/Abstractions/IPasswordRepromptService.cs @@ -7,5 +7,7 @@ namespace Bit.App.Abstractions string[] ProtectedFields { get; } Task ShowPasswordPromptAsync(); + + Task Enabled(); } } diff --git a/src/App/App.xaml.cs b/src/App/App.xaml.cs index f3b80e68f..470d51342 100644 --- a/src/App/App.xaml.cs +++ b/src/App/App.xaml.cs @@ -140,6 +140,15 @@ namespace Bit.App } }); } + else if (message.Command == "convertAccountToKeyConnector") + { + Device.BeginInvokeOnMainThread(async () => + { + await Application.Current.MainPage.Navigation.PushModalAsync( + new NavigationPage(new RemoveMasterPasswordPage())); + }); + } + }); } diff --git a/src/App/Pages/Accounts/LockPage.xaml.cs b/src/App/Pages/Accounts/LockPage.xaml.cs index 428772647..5612ce674 100644 --- a/src/App/Pages/Accounts/LockPage.xaml.cs +++ b/src/App/Pages/Accounts/LockPage.xaml.cs @@ -11,7 +11,6 @@ namespace Bit.App.Pages { public partial class LockPage : BaseContentPage { - private readonly IStorageService _storageService; private readonly AppOptions _appOptions; private readonly bool _autoPromptBiometric; private readonly LockPageViewModel _vm; @@ -21,7 +20,6 @@ namespace Bit.App.Pages public LockPage(AppOptions appOptions = null, bool autoPromptBiometric = true) { - _storageService = ServiceContainer.Resolve("storageService"); _appOptions = appOptions; _autoPromptBiometric = autoPromptBiometric; InitializeComponent(); @@ -130,6 +128,7 @@ namespace Bit.App.Pages return; } var previousPage = await AppHelpers.ClearPreviousPage(); + Application.Current.MainPage = new TabsPage(_appOptions, previousPage); } } diff --git a/src/App/Pages/Accounts/LockPageViewModel.cs b/src/App/Pages/Accounts/LockPageViewModel.cs index 673ce6104..06fd30ac7 100644 --- a/src/App/Pages/Accounts/LockPageViewModel.cs +++ b/src/App/Pages/Accounts/LockPageViewModel.cs @@ -28,6 +28,7 @@ namespace Bit.App.Pages private readonly IEnvironmentService _environmentService; private readonly IStateService _stateService; private readonly IBiometricService _biometricService; + private readonly IKeyConnectorService _keyConnectorService; private string _email; private bool _showPassword; @@ -54,6 +55,7 @@ namespace Bit.App.Pages _environmentService = ServiceContainer.Resolve("environmentService"); _stateService = ServiceContainer.Resolve("stateService"); _biometricService = ServiceContainer.Resolve("biometricService"); + _keyConnectorService = ServiceContainer.Resolve("keyConnectorService"); PageTitle = AppResources.VerifyMasterPassword; TogglePasswordCommand = new Command(TogglePassword); @@ -124,6 +126,12 @@ namespace Bit.App.Pages _pinSet = await _vaultTimeoutService.IsPinLockSetAsync(); PinLock = (_pinSet.Item1 && _vaultTimeoutService.PinProtectedKey != null) || _pinSet.Item2; BiometricLock = await _vaultTimeoutService.IsBiometricLockSetAsync() && await _cryptoService.HasKeyAsync(); + + // Users with key connector and without biometric or pin has no MP to unlock with + if (await _keyConnectorService.GetUsesKeyConnector() && !(BiometricLock || PinLock)) + { + await _vaultTimeoutService.LogOutAsync(); + } _email = await _userService.GetEmailAsync(); var webVault = _environmentService.GetWebVaultUrl(); if (string.IsNullOrWhiteSpace(webVault)) diff --git a/src/App/Pages/Accounts/LoginSsoPage.xaml.cs b/src/App/Pages/Accounts/LoginSsoPage.xaml.cs index 4b9bb4b70..19a9edce3 100644 --- a/src/App/Pages/Accounts/LoginSsoPage.xaml.cs +++ b/src/App/Pages/Accounts/LoginSsoPage.xaml.cs @@ -116,7 +116,14 @@ namespace Bit.App.Pages { RestoreAppOptionsFromCopy(); await AppHelpers.ClearPreviousPage(); - Application.Current.MainPage = new NavigationPage(new LockPage(_appOptions)); + if (await _vaultTimeoutService.IsLockedAsync()) + { + Application.Current.MainPage = new NavigationPage(new LockPage(_appOptions)); + } + else + { + Application.Current.MainPage = new TabsPage(_appOptions, null); + } } } } diff --git a/src/App/Pages/Accounts/RemoveMasterPasswordPage.xaml b/src/App/Pages/Accounts/RemoveMasterPasswordPage.xaml new file mode 100644 index 000000000..a18840ce9 --- /dev/null +++ b/src/App/Pages/Accounts/RemoveMasterPasswordPage.xaml @@ -0,0 +1,33 @@ + + + + + + + + + + + +