mirror of
https://github.com/bitwarden/browser
synced 2025-12-23 19:53:43 +00:00
* [PM-2014] feat: scaffold new fido2 login component and module * [PM-1024] feat: add content to login settings component * [PM-1024] feat: add badge and button aria label * [PM-2014] feat: create new dialog * feat: add ability to remove form field bottom margin (cherry picked from commit 05925ff77ed47f3865c2aecade8271390d9e2fa6) * [PM-2014] feat: disable dialog close button * [PM-2014] feat: implement mocked failing wizard flow * [PM-2014] feat: add icons and other content * [PM-2014] feat: change wording to "creating" password * [PM-2014] feat: add new auth and auth core modules * [PM-2014] chore: move fido2-login-settings to auth module * [PM-2014] chore: expose using barrel files * [PM-2014] feat: fetch webauthn challenge * [PM-2014] chore: refactor api logic into new api service and move ui logic into existing service * [PM-2014] feat: add tests for new credential options * [PM-2014] feat: return undefined when credential creation fails * [PM-2014] feat: implement credential creation * [PM-2014] feat: add passkey naming ui * [PM-2014] feat: add support for creation token * [PM-2014] feat: implement credential saving * [PM-2014] feat: Basic list of credentials * [PM-2014] feat: improve async data loading * [PM-2014] feat: finish up list UI * [PM-2014] fix: loading state not being set properly * [PM-2014] feat: improve aria labels * [PM-2014] feat: show toast on passkey saved * [PM-2014] feat: add delete dialog * [PM-2014] feat: implement deletion without user verification * [PM-2014] feat: add user verification to delete * [PM-2014] feat: change to danger button * [PM-2014] feat: show `save` if passkeys already exist * [PM-2014] feat: add passkey limit * [PM-2014] feat: improve error on delete * [PM-2014] feat: add support for feature flag * [PM-2014] feat: update copy * [PM-2014] feat: reduce remove button margin * [PM-2014] feat: refactor submit method * [PM-2014] feat: autofocus fields * [PM-2014] fix: move error handling to components After discussing it with Jake we decided that following convention was best. * [PM-2014] feat: change toast depending on existing passkeys * [PM-2014] chore: rename everything from `fido2` to `webauthn` * [PM-2014] fix: `CoreAuthModule` duplicate import * [PM-2014] feat: change to new figma design `Encryption not supported` * [PM-2014] fix: add missing href * [PM-2014] fix: misaligned badge * [PM-2014] chore: remove whitespace * [PM-2014] fix: dialog close bug * [PM-2014] fix: badge alignment not applying properly * [PM-2014] fix: remove redundant align class * [PM-2014] chore: move CoreAuthModule to AuthModule * [PM-2014] feat: create new settings module * [PM-2014] feat: move change password component to settings module * [PM-2014] chore: tweak loose components recommendation * [PM-2014] fix: remove deprecated pattern * [PM-2014] chore: rename everything to `WebauthnLogin` to follow new naming scheme * [PM-2014] chore: document requests and responses * [PM-2014] fix: remove `undefined` * [PM-2014] fix: clarify webauthn login service * [PM-2014] fix: use `getCredentials$()` * [PM-2014] fix: badge alignment using important statement * [PM-2014] fix: remove sm billing flag * [PM-2014] fix: `CoreAuthModule` double import * [PM-2014] fix: unimported component (issue due to conflict with master) * [PM-2014] fix: unawaited promise bug
73 lines
2.0 KiB
TypeScript
73 lines
2.0 KiB
TypeScript
import { Component, HostBinding, OnDestroy, OnInit } from "@angular/core";
|
|
import { Subject, takeUntil } from "rxjs";
|
|
|
|
import { DialogService } from "@bitwarden/components";
|
|
|
|
import { WebauthnLoginService } from "../../core";
|
|
import { WebauthnCredentialView } from "../../core/views/webauth-credential.view";
|
|
|
|
import { openCreateCredentialDialog } from "./create-credential-dialog/create-credential-dialog.component";
|
|
import { openDeleteCredentialDialogComponent } from "./delete-credential-dialog/delete-credential-dialog.component";
|
|
|
|
@Component({
|
|
selector: "app-webauthn-login-settings",
|
|
templateUrl: "webauthn-login-settings.component.html",
|
|
host: {
|
|
"aria-live": "polite",
|
|
},
|
|
})
|
|
export class WebauthnLoginSettingsComponent implements OnInit, OnDestroy {
|
|
private destroy$ = new Subject<void>();
|
|
|
|
protected readonly MaxCredentialCount = 5;
|
|
|
|
protected credentials?: WebauthnCredentialView[];
|
|
protected loading = true;
|
|
|
|
constructor(
|
|
private webauthnService: WebauthnLoginService,
|
|
private dialogService: DialogService
|
|
) {}
|
|
|
|
@HostBinding("attr.aria-busy")
|
|
get ariaBusy() {
|
|
return this.loading ? "true" : "false";
|
|
}
|
|
|
|
get hasCredentials() {
|
|
return this.credentials && this.credentials.length > 0;
|
|
}
|
|
|
|
get hasData() {
|
|
return this.credentials !== undefined;
|
|
}
|
|
|
|
get limitReached() {
|
|
return this.credentials?.length >= this.MaxCredentialCount;
|
|
}
|
|
|
|
ngOnInit(): void {
|
|
this.webauthnService
|
|
.getCredentials$()
|
|
.pipe(takeUntil(this.destroy$))
|
|
.subscribe((credentials) => (this.credentials = credentials));
|
|
|
|
this.webauthnService.loading$
|
|
.pipe(takeUntil(this.destroy$))
|
|
.subscribe((loading) => (this.loading = loading));
|
|
}
|
|
|
|
ngOnDestroy(): void {
|
|
this.destroy$.next();
|
|
this.destroy$.complete();
|
|
}
|
|
|
|
protected createCredential() {
|
|
openCreateCredentialDialog(this.dialogService, {});
|
|
}
|
|
|
|
protected deleteCredential(credentialId: string) {
|
|
openDeleteCredentialDialogComponent(this.dialogService, { data: { credentialId } });
|
|
}
|
|
}
|