1
0
mirror of https://github.com/bitwarden/browser synced 2026-01-06 02:23:44 +00:00

Merge branch 'main' into auth/pm-8111/browser-refresh-login-component

This commit is contained in:
Alec Rippberger
2024-10-03 21:35:15 -05:00
committed by GitHub
23 changed files with 134 additions and 87 deletions

View File

@@ -461,11 +461,10 @@ describe("LockComponent", () => {
});
describe("canUseBiometric", () => {
it("should call getUserId() on stateService", async () => {
stateServiceMock.getUserId.mockResolvedValue("userId");
it("should call biometric.enabled with current active user", async () => {
await component["canUseBiometric"]();
expect(ipc.keyManagement.biometric.enabled).toHaveBeenCalledWith("userId");
expect(ipc.keyManagement.biometric.enabled).toHaveBeenCalledWith(mockUserId);
});
});

View File

@@ -1,6 +1,6 @@
import { Component, NgZone, OnDestroy, OnInit } from "@angular/core";
import { ActivatedRoute, Router } from "@angular/router";
import { firstValueFrom, switchMap } from "rxjs";
import { firstValueFrom, map, switchMap } from "rxjs";
import { LockComponent as BaseLockComponent } from "@bitwarden/angular/auth/components/lock.component";
import { PinServiceAbstraction } from "@bitwarden/auth/common";
@@ -182,7 +182,7 @@ export class LockComponent extends BaseLockComponent implements OnInit, OnDestro
}
private async canUseBiometric() {
const userId = await this.stateService.getUserId();
const userId = await firstValueFrom(this.accountService.activeAccount$.pipe(map((a) => a?.id)));
return await ipc.keyManagement.biometric.enabled(userId);
}