From 24378d937ee9799de21dfa46d33cf4a107a7db71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bispo?= Date: Tue, 8 Aug 2023 20:12:01 +0100 Subject: [PATCH] [PM-3319] Check for admin request in Lock page (#2668) * [PM-3319] Ignore admin auth request when choosing mp as decryption option. --- src/App/Pages/Accounts/LockPage.xaml.cs | 3 ++- src/App/Pages/Accounts/LockPageViewModel.cs | 4 +++- src/App/Pages/Accounts/LoginApproveDevicePage.xaml.cs | 2 +- src/App/Resources/AppResources.resx | 1 - 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/App/Pages/Accounts/LockPage.xaml.cs b/src/App/Pages/Accounts/LockPage.xaml.cs index d62b4c6b2..f19d41f40 100644 --- a/src/App/Pages/Accounts/LockPage.xaml.cs +++ b/src/App/Pages/Accounts/LockPage.xaml.cs @@ -20,13 +20,14 @@ namespace Bit.App.Pages private bool _promptedAfterResume; private bool _appeared; - public LockPage(AppOptions appOptions = null, bool autoPromptBiometric = true) + public LockPage(AppOptions appOptions = null, bool autoPromptBiometric = true, bool checkPendingAuthRequests = true) { _appOptions = appOptions; _autoPromptBiometric = autoPromptBiometric; InitializeComponent(); _broadcasterService = ServiceContainer.Resolve(); _vm = BindingContext as LockPageViewModel; + _vm.CheckPendingAuthRequests = checkPendingAuthRequests; _vm.Page = this; _vm.UnlockedAction = () => Device.BeginInvokeOnMainThread(async () => await UnlockedAsync()); diff --git a/src/App/Pages/Accounts/LockPageViewModel.cs b/src/App/Pages/Accounts/LockPageViewModel.cs index 6b9137322..f283964df 100644 --- a/src/App/Pages/Accounts/LockPageViewModel.cs +++ b/src/App/Pages/Accounts/LockPageViewModel.cs @@ -149,6 +149,8 @@ namespace Bit.App.Pages set => SetProperty(ref _lockedVerifyText, value); } + public bool CheckPendingAuthRequests { get; set; } + public AccountSwitchingOverlayViewModel AccountSwitchingOverlayViewModel { get; } public Command SubmitCommand { get; } @@ -165,7 +167,7 @@ namespace Bit.App.Pages public async Task InitAsync() { var pendingRequest = await _stateService.GetPendingAdminAuthRequestAsync(); - if (pendingRequest != null) + if (pendingRequest != null && CheckPendingAuthRequests) { await _vaultTimeoutService.LogOutAsync(); return; diff --git a/src/App/Pages/Accounts/LoginApproveDevicePage.xaml.cs b/src/App/Pages/Accounts/LoginApproveDevicePage.xaml.cs index 5f3e0a88b..1509a92f0 100644 --- a/src/App/Pages/Accounts/LoginApproveDevicePage.xaml.cs +++ b/src/App/Pages/Accounts/LoginApproveDevicePage.xaml.cs @@ -44,7 +44,7 @@ namespace Bit.App.Pages private async Task StartLogInWithMasterPasswordAsync() { - var page = new LockPage(_appOptions); + var page = new LockPage(_appOptions, checkPendingAuthRequests: false); await Navigation.PushModalAsync(new NavigationPage(page)); } diff --git a/src/App/Resources/AppResources.resx b/src/App/Resources/AppResources.resx index 89656666c..ef128b045 100644 --- a/src/App/Resources/AppResources.resx +++ b/src/App/Resources/AppResources.resx @@ -2756,5 +2756,4 @@ Do you want to switch to this account? Log in with device must be set up in the settings of the Bitwarden app. Need another option? -