Skip to content

Commit 1629daf

Browse files
committed
[Account Recovery][PM-18721] convert retreival of policy options to be observable first
1 parent adbeed5 commit 1629daf

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

apps/web/src/app/admin-console/organizations/members/components/account-recovery/account-recovery-dialog.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<auth-input-password
88
[flow]="inputPasswordFlow"
99
[message]="'resetPasswordMasterPasswordPolicyInEffect'"
10-
[masterPasswordPolicyOptions]="masterPasswordPolicyOptions"
10+
[masterPasswordPolicyOptions]="masterPasswordPolicyOptions$ | async"
1111
(onPasswordFormSubmit)="handlePasswordFormSubmit($event)"
1212
></auth-input-password>
1313
</ng-container>

apps/web/src/app/admin-console/organizations/members/components/account-recovery/account-recovery-dialog.component.ts

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { CommonModule } from "@angular/common";
2-
import { Component, Inject, OnInit, ViewChild } from "@angular/core";
3-
import { firstValueFrom } from "rxjs";
2+
import { Component, Inject, ViewChild } from "@angular/core";
3+
import { switchMap } from "rxjs";
44

55
import {
66
InputPasswordComponent,
@@ -79,7 +79,7 @@ type AccountRecoveryDialogResultType =
7979
InputPasswordComponent,
8080
],
8181
})
82-
export class AccountRecoveryDialogComponent implements OnInit {
82+
export class AccountRecoveryDialogComponent {
8383
@ViewChild(InputPasswordComponent)
8484
inputPasswordComponent!: InputPasswordComponent;
8585

@@ -88,6 +88,11 @@ export class AccountRecoveryDialogComponent implements OnInit {
8888
receivedPasswordInputResult = false;
8989
submitting = false;
9090

91+
masterPasswordPolicyOptions$ = this.accountService.activeAccount$.pipe(
92+
getUserId,
93+
switchMap((userId) => this.policyService.masterPasswordPolicyOptions$(userId)),
94+
);
95+
9196
get loggedOutWarningName() {
9297
return this.dialogData.name != null ? this.dialogData.name : this.i18nService.t("thisUser");
9398
}
@@ -103,14 +108,6 @@ export class AccountRecoveryDialogComponent implements OnInit {
103108
private toastService: ToastService,
104109
) {}
105110

106-
async ngOnInit() {
107-
const userId = await firstValueFrom(this.accountService.activeAccount$.pipe(getUserId));
108-
109-
this.masterPasswordPolicyOptions = await firstValueFrom(
110-
this.policyService.masterPasswordPolicyOptions$(userId),
111-
);
112-
}
113-
114111
handlePrimaryButtonClick = async () => {
115112
try {
116113
this.submitting = true;

0 commit comments

Comments
 (0)