1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-19 09:43:23 +00:00

Unset active account when adding additional accounts (#1258)

This commit is contained in:
Addison Beck
2022-01-24 07:28:39 -05:00
committed by GitHub
parent ef48ba1ae2
commit d211b3fcd2
4 changed files with 37 additions and 18 deletions

View File

@@ -65,7 +65,9 @@ export class AccountSwitcherComponent implements OnInit {
];
get showSwitcher() {
return !Utils.isNullOrWhitespace(this.activeAccountEmail);
const userIsInAVault = !Utils.isNullOrWhitespace(this.activeAccountEmail);
const userIsAddingAnAdditionalAccount = Object.keys(this.accounts).length > 0;
return userIsInAVault || userIsAddingAnAdditionalAccount;
}
get numberOfAccounts() {
@@ -111,6 +113,11 @@ export class AccountSwitcherComponent implements OnInit {
this.messagingService.send("switchAccount", { userId: userId });
}
async addAccount() {
this.toggle();
await this.stateService.setActiveUser(null);
}
private async createSwitcherAccounts(baseAccounts: {
[userId: string]: Account;
}): Promise<{ [userId: string]: SwitcherAccount }> {