From 6b2700bcaadb77147d7b3508a0f5113a430d3c6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bispo?= Date: Tue, 8 Aug 2023 19:36:49 +0100 Subject: [PATCH] [PM-3342] Not you button logs user out. (#2672) --- src/App/Pages/Accounts/LoginApproveDevicePage.xaml | 2 +- src/App/Pages/Accounts/LoginApproveDevicePage.xaml.cs | 9 --------- src/App/Pages/Accounts/LoginApproveDeviceViewModel.cs | 6 +++++- src/iOS.Autofill/CredentialProviderViewController.cs | 1 - src/iOS.Extension/LoadingViewController.cs | 1 - src/iOS.ShareExtension/LoadingViewController.cs | 1 - 6 files changed, 6 insertions(+), 14 deletions(-) diff --git a/src/App/Pages/Accounts/LoginApproveDevicePage.xaml b/src/App/Pages/Accounts/LoginApproveDevicePage.xaml index 5ca8adbaa..42edf6371 100644 --- a/src/App/Pages/Accounts/LoginApproveDevicePage.xaml +++ b/src/App/Pages/Accounts/LoginApproveDevicePage.xaml @@ -66,7 +66,7 @@ TextColor="{DynamicResource HyperlinkColor}" AutomationId="NotYouLabel"> - + diff --git a/src/App/Pages/Accounts/LoginApproveDevicePage.xaml.cs b/src/App/Pages/Accounts/LoginApproveDevicePage.xaml.cs index ec042e4d5..5f3e0a88b 100644 --- a/src/App/Pages/Accounts/LoginApproveDevicePage.xaml.cs +++ b/src/App/Pages/Accounts/LoginApproveDevicePage.xaml.cs @@ -23,7 +23,6 @@ namespace Bit.App.Pages _vm.LogInWithDeviceAction = () => StartLoginWithDeviceAsync().FireAndForget(); _vm.RequestAdminApprovalAction = () => RequestAdminApprovalAsync().FireAndForget(); _vm.ContinueToVaultAction = () => ContinueToVaultAsync().FireAndForget(); - _vm.CloseAction = () => { Navigation.PopModalAsync(); }; _vm.Page = this; _appOptions = appOptions; } @@ -33,14 +32,6 @@ namespace Bit.App.Pages _vm.InitAsync(); } - private void Cancel_Clicked(object sender, EventArgs e) - { - if (DoOnce()) - { - _vm.CloseAction(); - } - } - private async Task ContinueToVaultAsync() { if (AppHelpers.SetAlternateMainPage(_appOptions)) diff --git a/src/App/Pages/Accounts/LoginApproveDeviceViewModel.cs b/src/App/Pages/Accounts/LoginApproveDeviceViewModel.cs index 2ff9798c5..0b31d59b6 100644 --- a/src/App/Pages/Accounts/LoginApproveDeviceViewModel.cs +++ b/src/App/Pages/Accounts/LoginApproveDeviceViewModel.cs @@ -29,17 +29,18 @@ namespace Bit.App.Pages private IDeviceTrustCryptoService _deviceTrustCryptoService; private readonly IAuthService _authService; private readonly ISyncService _syncService; + private readonly IMessagingService _messagingService; public ICommand ApproveWithMyOtherDeviceCommand { get; } public ICommand RequestAdminApprovalCommand { get; } public ICommand ApproveWithMasterPasswordCommand { get; } public ICommand ContinueCommand { get; } + public ICommand LogoutCommand { get; } public Action LogInWithMasterPasswordAction { get; set; } public Action LogInWithDeviceAction { get; set; } public Action RequestAdminApprovalAction { get; set; } public Action ContinueToVaultAction { get; set; } - public Action CloseAction { get; set; } public LoginApproveDeviceViewModel() { @@ -48,6 +49,7 @@ namespace Bit.App.Pages _deviceTrustCryptoService = ServiceContainer.Resolve(); _authService = ServiceContainer.Resolve(); _syncService = ServiceContainer.Resolve(); + _messagingService = ServiceContainer.Resolve(); PageTitle = AppResources.LogInInitiated; RememberThisDevice = true; @@ -67,6 +69,8 @@ namespace Bit.App.Pages ContinueCommand = new AsyncCommand(CreateNewSsoUserAsync, onException: ex => HandleException(ex), allowsMultipleExecutions: false); + + LogoutCommand = new Command(() => _messagingService.Send(AccountsManagerMessageCommands.LOGOUT)); } public string LoggingInAsText => string.Format(AppResources.LoggingInAsX, Email); diff --git a/src/iOS.Autofill/CredentialProviderViewController.cs b/src/iOS.Autofill/CredentialProviderViewController.cs index 0ba9ba458..e3dbc2d9e 100644 --- a/src/iOS.Autofill/CredentialProviderViewController.cs +++ b/src/iOS.Autofill/CredentialProviderViewController.cs @@ -634,7 +634,6 @@ namespace Bit.iOS.Autofill vm.LogInWithMasterPasswordAction = () => DismissViewController(false, () => PerformSegue("lockPasswordSegue", this)); vm.RequestAdminApprovalAction = () => DismissViewController(false, () => LaunchLoginWithDevice(AuthRequestType.AdminApproval, vm.Email)); vm.LogInWithDeviceAction = () => DismissViewController(false, () => LaunchLoginWithDevice(AuthRequestType.AuthenticateAndUnlock, vm.Email)); - vm.CloseAction = () => DismissViewController(false, () => LaunchHomePage()); } var navigationPage = new NavigationPage(loginApproveDevicePage); diff --git a/src/iOS.Extension/LoadingViewController.cs b/src/iOS.Extension/LoadingViewController.cs index 7f9d451c2..8882e1adb 100644 --- a/src/iOS.Extension/LoadingViewController.cs +++ b/src/iOS.Extension/LoadingViewController.cs @@ -656,7 +656,6 @@ namespace Bit.iOS.Extension vm.LogInWithMasterPasswordAction = () => DismissViewController(false, () => PerformSegue("lockPasswordSegue", this)); vm.RequestAdminApprovalAction = () => DismissViewController(false, () => LaunchLoginWithDevice(AuthRequestType.AdminApproval, vm.Email)); vm.LogInWithDeviceAction = () => DismissViewController(false, () => LaunchLoginWithDevice(AuthRequestType.AuthenticateAndUnlock, vm.Email)); - vm.CloseAction = () => DismissViewController(false, () => LaunchHomePage()); } var navigationPage = new NavigationPage(loginApproveDevicePage); diff --git a/src/iOS.ShareExtension/LoadingViewController.cs b/src/iOS.ShareExtension/LoadingViewController.cs index 200946cfa..4442bc215 100644 --- a/src/iOS.ShareExtension/LoadingViewController.cs +++ b/src/iOS.ShareExtension/LoadingViewController.cs @@ -440,7 +440,6 @@ namespace Bit.iOS.ShareExtension vm.LogInWithMasterPasswordAction = () => DismissViewController(false, () => PerformSegue("lockPasswordSegue", this)); vm.RequestAdminApprovalAction = () => DismissViewController(false, () => LaunchLoginWithDevice(AuthRequestType.AdminApproval, vm.Email)); vm.LogInWithDeviceAction = () => DismissViewController(false, () => LaunchLoginWithDevice(AuthRequestType.AuthenticateAndUnlock, vm.Email)); - vm.CloseAction = () => DismissViewController(false, () => LaunchHomePage()); } var navigationPage = new NavigationPage(loginApproveDevicePage);