1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-09 05:00:10 +00:00

initialize data before rendering InputPasswordComponent

This commit is contained in:
rr-bw
2025-04-24 21:30:48 -07:00
parent f1ab6856b9
commit fbaa33eb32
3 changed files with 25 additions and 12 deletions

View File

@@ -1,10 +1,19 @@
<auth-input-password
[flow]="inputPasswordFlow"
[email]="email"
[userId]="userId"
[masterPasswordPolicyOptions]="masterPasswordPolicyOptions"
[inlineButtons]="true"
[primaryButtonText]="{ key: 'changeMasterPassword' }"
(onPasswordFormSubmit)="handlePasswordFormSubmit($event)"
>
</auth-input-password>
@if (initializing) {
<i
class="bwi bwi-spinner bwi-spin bwi-2x tw-text-muted"
title="{{ 'loading' | i18n }}"
aria-hidden="true"
></i>
<span class="tw-sr-only">{{ "loading" | i18n }}</span>
} @else {
<auth-input-password
[flow]="inputPasswordFlow"
[email]="email"
[userId]="userId"
[masterPasswordPolicyOptions]="masterPasswordPolicyOptions"
[inlineButtons]="true"
[primaryButtonText]="{ key: 'changeMasterPassword' }"
(onPasswordFormSubmit)="handlePasswordFormSubmit($event)"
>
</auth-input-password>
}

View File

@@ -17,6 +17,7 @@ import { UserId } from "@bitwarden/common/types/guid";
import { UserKey } from "@bitwarden/common/types/key";
import { ToastService } from "@bitwarden/components";
import { KeyService } from "@bitwarden/key-management";
import { I18nPipe } from "@bitwarden/ui-common";
import {
InputPasswordComponent,
@@ -30,7 +31,7 @@ import { ChangePasswordService } from "./change-password.service.abstraction";
standalone: true,
selector: "auth-change-password",
templateUrl: "change-password.component.html",
imports: [InputPasswordComponent],
imports: [InputPasswordComponent, I18nPipe],
})
export class ChangePasswordComponent implements OnInit {
@Input() inputPasswordFlow: InputPasswordFlow = InputPasswordFlow.ChangePassword;
@@ -39,6 +40,7 @@ export class ChangePasswordComponent implements OnInit {
email?: string;
userId?: UserId;
masterPasswordPolicyOptions?: MasterPasswordPolicyOptions;
initializing = true;
userkeyRotationV2 = false;
formPromise?: Promise<any>;
@@ -70,6 +72,8 @@ export class ChangePasswordComponent implements OnInit {
this.masterPasswordPolicyOptions = await firstValueFrom(
this.policyService.masterPasswordPolicyOptions$(this.userId),
);
this.initializing = false;
}
async handlePasswordFormSubmit(passwordInputResult: PasswordInputResult) {

View File

@@ -223,7 +223,7 @@ export class InputPasswordComponent implements OnInit {
return;
}
if (this.email == null) {
if (!this.email) {
throw new Error("Email is required to create master key.");
}