mirror of
https://github.com/bitwarden/android.git
synced 2024-10-31 15:15:34 +03:00
take environment into account when checking for existing account (#1808)
This commit is contained in:
parent
2e8824ce05
commit
9201da8515
1 changed files with 16 additions and 7 deletions
|
@ -141,15 +141,12 @@ namespace Bit.App.Pages
|
|||
var userId = await _stateService.GetUserIdAsync(Email);
|
||||
if (!string.IsNullOrWhiteSpace(userId))
|
||||
{
|
||||
var switchToAccount = await _platformUtilsService.ShowDialogAsync(
|
||||
AppResources.SwitchToAlreadyAddedAccountConfirmation,
|
||||
AppResources.AccountAlreadyAdded, AppResources.Yes, AppResources.Cancel);
|
||||
if (switchToAccount)
|
||||
var userEnvUrls = await _stateService.GetEnvironmentUrlsAsync(userId);
|
||||
if (userEnvUrls?.Base == _environmentService.BaseUrl)
|
||||
{
|
||||
await _stateService.SetActiveUserAsync(userId);
|
||||
_messagingService.Send("switchedAccount");
|
||||
await PromptToSwitchToExistingAccountAsync(userId);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -229,5 +226,17 @@ namespace Bit.App.Pages
|
|||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
private async Task PromptToSwitchToExistingAccountAsync(string userId)
|
||||
{
|
||||
var switchToAccount = await _platformUtilsService.ShowDialogAsync(
|
||||
AppResources.SwitchToAlreadyAddedAccountConfirmation,
|
||||
AppResources.AccountAlreadyAdded, AppResources.Yes, AppResources.Cancel);
|
||||
if (switchToAccount)
|
||||
{
|
||||
await _stateService.SetActiveUserAsync(userId);
|
||||
_messagingService.Send("switchedAccount");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue