1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-23 11:43:46 +00:00

[PM-2414] Angular 16 Upgrade - SetPinComponent (#7214)

* migrate to DialogService

* use static method

* add reactive form dependencies

* begin migrating to reactive forms

* migrate template inputs to use CL

* update set-pin.component.ts file to work with reactive forms

* migrate desktop template and class file to Dialog and ReactiveForms

* update settings page

* remove old properties

* update settings form upon dialog close

* refactor ngOnInit()

* remove duplicate validator (already have a validator in class file)
This commit is contained in:
rr-bw
2023-12-27 10:48:06 -08:00
committed by GitHub
parent 3d30823d2a
commit 00bb814fbe
9 changed files with 146 additions and 161 deletions

View File

@@ -409,16 +409,17 @@ export class SettingsComponent implements OnInit {
async updatePin(value: boolean) {
if (value) {
const ref = this.modalService.open(SetPinComponent, { allowMultipleModals: true });
const dialogRef = SetPinComponent.open(this.dialogService);
if (ref == null) {
if (dialogRef == null) {
this.form.controls.pin.setValue(false, { emitEvent: false });
return;
}
this.userHasPinSet = await ref.onClosedPromise();
this.userHasPinSet = await firstValueFrom(dialogRef.closed);
this.form.controls.pin.setValue(this.userHasPinSet, { emitEvent: false });
}
if (!value) {
// If user turned off PIN without having a MP and has biometric + require MP/PIN on restart enabled
if (this.form.value.requirePasswordOnStart && !this.userHasMasterPassword) {
@@ -429,6 +430,7 @@ export class SettingsComponent implements OnInit {
await this.vaultTimeoutSettingsService.clear();
}
this.messagingService.send("redrawMenu");
}