1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-21 11:35:34 +01:00

Lock active account first (#5241)

Locking all non-active accounts prior to active lead to process reload
issues.

Remove unnecessary routing

Prefer Record keys to deep Account object value

Await promises
This commit is contained in:
Matt Gibson 2023-04-20 13:46:03 -04:00 committed by GitHub
parent aacabf5bdf
commit c47194b21c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -180,13 +180,17 @@ export class AppComponent implements OnInit, OnDestroy {
case "lockVault":
await this.vaultTimeoutService.lock(message.userId);
break;
case "lockAllVaults":
for (const userId in await firstValueFrom(this.stateService.accounts$)) {
if (userId != null) {
await this.vaultTimeoutService.lock(userId);
}
}
case "lockAllVaults": {
const currentUser = await this.stateService.getUserId();
const accounts = await firstValueFrom(this.stateService.accounts$);
await this.vaultTimeoutService.lock(currentUser);
Promise.all(
Object.keys(accounts)
.filter((u) => u !== currentUser)
.map((u) => this.vaultTimeoutService.lock(u))
);
break;
}
case "locked":
this.modalService.closeAll();
if (