1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-24 16:43:27 +00:00

Added support for handling a locked vault

This commit is contained in:
Anders Åberg
2025-03-19 23:52:12 +01:00
parent 6c31687c55
commit 5ccb09d0bb
2 changed files with 28 additions and 5 deletions

View File

@@ -252,10 +252,19 @@ export class DesktopFido2UserInterfaceSession implements Fido2UserInterfaceSessi
}
}
private async showUi(route: string, position?: { x: number; y: number }): Promise<void> {
private async showUi(
route: string,
position?: { x: number; y: number },
disableRedirect?: boolean,
): Promise<void> {
// Load the UI:
await this.desktopSettingsService.setModalMode(true, position);
await this.router.navigate([route]);
await this.router.navigate([
route,
{
"disable-redirect": disableRedirect || null,
},
]);
}
/**
@@ -309,7 +318,17 @@ export class DesktopFido2UserInterfaceSession implements Fido2UserInterfaceSessi
const status = await firstValueFrom(this.authService.activeAccountStatus$);
if (status !== AuthenticationStatus.Unlocked) {
throw new Error("Vault is not unlocked");
await this.showUi("/lock", this.windowObject.windowXy, true);
const status2 = await lastValueFrom(
this.authService.activeAccountStatus$.pipe(
filter((s) => s === AuthenticationStatus.Unlocked),
take(1),
timeout(30000),
),
);
if (status2 !== AuthenticationStatus.Unlocked) {
throw new Error("Vault is not unlocked");
}
}
}