1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-28 18:43:26 +00:00

add PasswordSettingsComponent ngOnInit

This commit is contained in:
rr-bw
2025-03-19 14:39:16 -07:00
parent 7eddf8b55a
commit 9fedf0ed56
3 changed files with 27 additions and 2 deletions

View File

@@ -1,6 +1,9 @@
import { Component } from "@angular/core";
import { Component, OnInit } from "@angular/core";
import { Router } from "@angular/router";
import { firstValueFrom } from "rxjs";
import { ChangeExistingPasswordComponent } from "@bitwarden/auth/angular";
import { UserDecryptionOptionsServiceAbstraction } from "@bitwarden/auth/common";
import { CalloutModule } from "@bitwarden/components";
import { I18nPipe } from "@bitwarden/ui-common";
@@ -12,4 +15,20 @@ import { WebauthnLoginSettingsModule } from "../../webauthn-login-settings";
templateUrl: "password-settings.component.html",
imports: [CalloutModule, ChangeExistingPasswordComponent, I18nPipe, WebauthnLoginSettingsModule],
})
export class PasswordSettingsComponent {}
export class PasswordSettingsComponent implements OnInit {
constructor(
private router: Router,
private userDecryptionOptionsService: UserDecryptionOptionsServiceAbstraction,
) {}
async ngOnInit() {
const userHasMasterPassword = await firstValueFrom(
this.userDecryptionOptionsService.hasMasterPassword$,
);
if (!userHasMasterPassword) {
await this.router.navigate(["/settings/security/two-factor"]);
return;
}
}
}