1
0
mirror of https://github.com/bitwarden/browser synced 2026-01-30 16:23:53 +00:00

Pass username to UV prompt for new credential

This commit is contained in:
Isaiah Inuwa
2025-12-18 09:02:16 -06:00
parent a5ae089a0a
commit bb867dd35b
2 changed files with 8 additions and 3 deletions

View File

@@ -136,9 +136,8 @@ export class Fido2CreateComponent implements OnInit, OnDestroy {
throw new Error("Missing session");
}
// TODO: We should know the username by now; we should pass that context here.
const username = "New Account" // placeholder
const isConfirmed = await this.session.promptForUserVerification("New Account", "Verify it's you to create a new credential")
const username = await this.session.getUserName();
const isConfirmed = await this.session.promptForUserVerification(username, "Verify it's you to create a new credential")
this.session.notifyConfirmCreateCredential(isConfirmed);
} catch {
await this.showErrorDialog(this.DIALOG_MESSAGES.unableToSavePasskey);

View File

@@ -104,6 +104,7 @@ export class DesktopFido2UserInterfaceSession implements Fido2UserInterfaceSessi
private updatedCipher: CipherView;
private rpId = new BehaviorSubject<string>(null);
private userName = new BehaviorSubject<string>(null);
private availableCipherIdsSubject = new BehaviorSubject<string[]>([""]);
/**
* Observable that emits available cipher IDs once they're confirmed by the UI
@@ -196,6 +197,10 @@ export class DesktopFido2UserInterfaceSession implements Fido2UserInterfaceSessi
return firstValueFrom(this.rpId.pipe(filter((id) => id != null)));
}
async getUserName(): Promise<string> {
return firstValueFrom(this.userName.pipe(filter((id) => id != null)));
}
confirmChosenCipher(cipherId: string, userVerified: boolean = false): void {
this.chosenCipherSubject.next({ cipherId, userVerified });
this.chosenCipherSubject.complete();
@@ -274,6 +279,7 @@ export class DesktopFido2UserInterfaceSession implements Fido2UserInterfaceSessi
rpId,
);
this.rpId.next(rpId);
this.userName.next(userName);
try {
await this.showUi("/fido2-creation", this.windowObject.windowXy, false);