From bb867dd35b1aaa5d8f8d5fbdbfb2b14745fd14ff Mon Sep 17 00:00:00 2001 From: Isaiah Inuwa Date: Thu, 18 Dec 2025 09:02:16 -0600 Subject: [PATCH] Pass username to UV prompt for new credential --- .../autofill/modal/credentials/fido2-create.component.ts | 5 ++--- .../services/desktop-fido2-user-interface.service.ts | 6 ++++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/apps/desktop/src/autofill/modal/credentials/fido2-create.component.ts b/apps/desktop/src/autofill/modal/credentials/fido2-create.component.ts index 97a7bfb310a..f7de4d4b74a 100644 --- a/apps/desktop/src/autofill/modal/credentials/fido2-create.component.ts +++ b/apps/desktop/src/autofill/modal/credentials/fido2-create.component.ts @@ -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); diff --git a/apps/desktop/src/autofill/services/desktop-fido2-user-interface.service.ts b/apps/desktop/src/autofill/services/desktop-fido2-user-interface.service.ts index 059e7dfb082..fe203fcf004 100644 --- a/apps/desktop/src/autofill/services/desktop-fido2-user-interface.service.ts +++ b/apps/desktop/src/autofill/services/desktop-fido2-user-interface.service.ts @@ -104,6 +104,7 @@ export class DesktopFido2UserInterfaceSession implements Fido2UserInterfaceSessi private updatedCipher: CipherView; private rpId = new BehaviorSubject(null); + private userName = new BehaviorSubject(null); private availableCipherIdsSubject = new BehaviorSubject([""]); /** * 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 { + 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);