mirror of
https://github.com/bitwarden/mobile.git
synced 2025-02-26 02:51:25 +01:00
take environment into account when checking for existing account (#1808)
This commit is contained in:
parent
2e8824ce05
commit
9201da8515
@ -141,17 +141,14 @@ namespace Bit.App.Pages
|
|||||||
var userId = await _stateService.GetUserIdAsync(Email);
|
var userId = await _stateService.GetUserIdAsync(Email);
|
||||||
if (!string.IsNullOrWhiteSpace(userId))
|
if (!string.IsNullOrWhiteSpace(userId))
|
||||||
{
|
{
|
||||||
var switchToAccount = await _platformUtilsService.ShowDialogAsync(
|
var userEnvUrls = await _stateService.GetEnvironmentUrlsAsync(userId);
|
||||||
AppResources.SwitchToAlreadyAddedAccountConfirmation,
|
if (userEnvUrls?.Base == _environmentService.BaseUrl)
|
||||||
AppResources.AccountAlreadyAdded, AppResources.Yes, AppResources.Cancel);
|
|
||||||
if (switchToAccount)
|
|
||||||
{
|
{
|
||||||
await _stateService.SetActiveUserAsync(userId);
|
await PromptToSwitchToExistingAccountAsync(userId);
|
||||||
_messagingService.Send("switchedAccount");
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (showLoading)
|
if (showLoading)
|
||||||
{
|
{
|
||||||
@ -229,5 +226,17 @@ namespace Bit.App.Pages
|
|||||||
#endif
|
#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 New Issue
Block a user