1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-15 07:43:35 +00:00

[PM-7972] Account switching integration with "remember email" functionality (#9750)

* add account switching logic to login email service

* enforce boolean and fix desktop account switcher order
This commit is contained in:
Jake Fink
2024-07-03 09:53:40 -04:00
committed by GitHub
parent 5839999fc4
commit 052b3be2eb
7 changed files with 225 additions and 32 deletions

View File

@@ -8,7 +8,6 @@ import {
AuthRequestServiceAbstraction,
AuthRequestService,
LoginEmailServiceAbstraction,
LoginEmailService,
LogoutReason,
} from "@bitwarden/auth/common";
import { ApiService as ApiServiceAbstraction } from "@bitwarden/common/abstractions/api.service";
@@ -708,8 +707,6 @@ export default class MainBackground {
this.stateProvider,
);
this.loginEmailService = new LoginEmailService(this.stateProvider);
this.ssoLoginService = new SsoLoginService(this.stateProvider);
this.userVerificationApiService = new UserVerificationApiService(this.apiService);
@@ -1255,9 +1252,6 @@ export default class MainBackground {
clearCaches();
if (userId == null) {
this.loginEmailService.setRememberEmail(false);
await this.loginEmailService.saveEmailSettings();
await this.refreshBadge();
await this.refreshMenu();
await this.overlayBackground?.updateOverlayCiphers(); // null in popup only contexts

View File

@@ -165,13 +165,10 @@ export class AccountSwitcherComponent {
async addAccount() {
this.close();
this.loginEmailService.setRememberEmail(false);
await this.loginEmailService.saveEmailSettings();
await this.router.navigate(["/login"]);
const activeAccount = await firstValueFrom(this.accountService.activeAccount$);
await this.stateService.clearDecryptedData(activeAccount?.id as UserId);
await this.accountService.switchAccount(null);
await this.router.navigate(["/login"]);
}
private async createInactiveAccounts(baseAccounts: {