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:
@@ -7,7 +7,7 @@
|
||||
<auth-input-password
|
||||
[flow]="inputPasswordFlow"
|
||||
[message]="'resetPasswordMasterPasswordPolicyInEffect'"
|
||||
[masterPasswordPolicyOptions]="masterPasswordPolicyOptions"
|
||||
[masterPasswordPolicyOptions]="masterPasswordPolicyOptions$ | async"
|
||||
(onPasswordFormSubmit)="handlePasswordFormSubmit($event)"
|
||||
></auth-input-password>
|
||||
</ng-container>
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user