1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-09 13:10:17 +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;
}
}
}

View File

@@ -6,5 +6,6 @@
[masterPasswordPolicyOptions]="masterPasswordPolicyOptions"
[inlineButtons]="true"
[primaryButtonText]="{ key: 'changeMasterPassword' }"
(onPasswordFormSubmit)="handlePasswordFormSubmit($event)"
>
</auth-input-password>

View File

@@ -9,6 +9,7 @@ import {
InputPasswordComponent,
InputPasswordFlow,
} from "../input-password/input-password.component";
import { PasswordInputResult } from "../input-password/password-input-result";
@Component({
standalone: true,
@@ -36,4 +37,8 @@ export class ChangeExistingPasswordComponent implements OnInit {
this.policyService.masterPasswordPolicyOptions$(),
);
}
handlePasswordFormSubmit(passwordInputResult: PasswordInputResult) {
// TODO-rr-bw: Full Sync if Rotate User Key is true (see setupSubmitActions)
}
}