1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-07 04:03:29 +00:00

[Account Recovery][PM-18721] convert retreival of policy options to be observable first

This commit is contained in:
rr-bw
2025-05-14 04:20:24 -07:00
parent 9360bb086a
commit 9b13ff547e
2 changed files with 9 additions and 12 deletions

View File

@@ -7,7 +7,7 @@
<auth-input-password
[flow]="inputPasswordFlow"
[message]="'resetPasswordMasterPasswordPolicyInEffect'"
[masterPasswordPolicyOptions]="masterPasswordPolicyOptions"
[masterPasswordPolicyOptions]="masterPasswordPolicyOptions$ | async"
(onPasswordFormSubmit)="handlePasswordFormSubmit($event)"
></auth-input-password>
</ng-container>

View File

@@ -1,6 +1,6 @@
import { CommonModule } from "@angular/common";
import { Component, Inject, OnInit, ViewChild } from "@angular/core";
import { firstValueFrom } from "rxjs";
import { Component, Inject, ViewChild } from "@angular/core";
import { switchMap } from "rxjs";
import {
InputPasswordComponent,
@@ -79,7 +79,7 @@ type AccountRecoveryDialogResultType =
InputPasswordComponent,
],
})
export class AccountRecoveryDialogComponent implements OnInit {
export class AccountRecoveryDialogComponent {
@ViewChild(InputPasswordComponent)
inputPasswordComponent!: InputPasswordComponent;
@@ -88,6 +88,11 @@ export class AccountRecoveryDialogComponent implements OnInit {
receivedPasswordInputResult = false;
submitting = false;
masterPasswordPolicyOptions$ = this.accountService.activeAccount$.pipe(
getUserId,
switchMap((userId) => this.policyService.masterPasswordPolicyOptions$(userId)),
);
get loggedOutWarningName() {
return this.dialogData.name != null ? this.dialogData.name : this.i18nService.t("thisUser");
}
@@ -103,14 +108,6 @@ export class AccountRecoveryDialogComponent implements OnInit {
private toastService: ToastService,
) {}
async ngOnInit() {
const userId = await firstValueFrom(this.accountService.activeAccount$.pipe(getUserId));
this.masterPasswordPolicyOptions = await firstValueFrom(
this.policyService.masterPasswordPolicyOptions$(userId),
);
}
handlePrimaryButtonClick = async () => {
try {
this.submitting = true;