mirror of
https://github.com/bitwarden/browser
synced 2026-02-06 11:43:51 +00:00
[PM-2014] feat: show save if passkeys already exist
This commit is contained in:
@@ -59,7 +59,7 @@
|
||||
{{ "tryAgain" | i18n }}
|
||||
</ng-container>
|
||||
<ng-container *ngIf="currentStep === 'credentialNaming'">
|
||||
{{ "turnOn" | i18n }}
|
||||
{{ ((hasPasskeys$ | async) ? "save" : "turnOn ") | i18n }}
|
||||
</ng-container>
|
||||
</button>
|
||||
<button type="button" bitButton bitFormButton buttonType="secondary" bitDialogClose>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { DialogConfig, DialogRef } from "@angular/cdk/dialog";
|
||||
import { Component } from "@angular/core";
|
||||
import { Component, OnInit } from "@angular/core";
|
||||
import { FormBuilder, Validators } from "@angular/forms";
|
||||
import { map, Observable } from "rxjs";
|
||||
|
||||
import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog";
|
||||
import { VerificationType } from "@bitwarden/common/auth/enums/verification-type";
|
||||
@@ -24,7 +25,7 @@ type Step =
|
||||
@Component({
|
||||
templateUrl: "create-credential-dialog.component.html",
|
||||
})
|
||||
export class CreateCredentialDialogComponent {
|
||||
export class CreateCredentialDialogComponent implements OnInit {
|
||||
protected readonly NameMaxCharacters = 50;
|
||||
protected readonly CreateCredentialDialogResult = CreateCredentialDialogResult;
|
||||
protected readonly Icons = { CreatePasskeyIcon, CreatePasskeyFailedIcon };
|
||||
@@ -40,6 +41,7 @@ export class CreateCredentialDialogComponent {
|
||||
});
|
||||
protected credentialOptions?: CredentialCreateOptionsView;
|
||||
protected deviceResponse?: PublicKeyCredential;
|
||||
protected hasPasskeys$?: Observable<boolean>;
|
||||
|
||||
constructor(
|
||||
private formBuilder: FormBuilder,
|
||||
@@ -47,6 +49,12 @@ export class CreateCredentialDialogComponent {
|
||||
private webauthnService: WebauthnService
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.hasPasskeys$ = this.webauthnService.credentials$.pipe(
|
||||
map((credentials) => credentials.length > 0)
|
||||
);
|
||||
}
|
||||
|
||||
protected submit = async () => {
|
||||
this.dialogRef.disableClose = true;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user