1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 00:33:44 +00:00

refactor getOrgPolicies call

This commit is contained in:
rr-bw
2024-08-27 16:21:08 -07:00
parent 688a24bd52
commit 97f9008b60
13 changed files with 49 additions and 68 deletions

View File

@@ -6,12 +6,9 @@ import { first, firstValueFrom, Subject, takeUntil } from "rxjs";
import { JslibModule } from "@bitwarden/angular/jslib.module";
import { LoginEmailServiceAbstraction } from "@bitwarden/auth/common";
import { PolicyApiServiceAbstraction } from "@bitwarden/common/admin-console/abstractions/policy/policy-api.service.abstraction";
import { InternalPolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction";
import { MasterPasswordPolicyOptions } from "@bitwarden/common/admin-console/models/domain/master-password-policy-options";
import { Policy } from "@bitwarden/common/admin-console/models/domain/policy";
import { ClientType } from "@bitwarden/common/enums";
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
import {
AsyncActionsModule,
@@ -56,10 +53,7 @@ export class LoginComponentV2 implements OnInit {
private formBuilder: FormBuilder,
private loginEmailService: LoginEmailServiceAbstraction,
private loginService: LoginService,
private logService: LogService,
private platformUtilsService: PlatformUtilsService,
private policyApiService: PolicyApiServiceAbstraction,
private policyService: InternalPolicyService,
private router: Router,
) {
this.clientType = this.platformUtilsService.getClientType();
@@ -93,15 +87,12 @@ export class LoginComponentV2 implements OnInit {
if (this.clientType === ClientType.Web) {
// If there's an existing org invite, use it to get the password policies
const orgInvite = await this.loginService.getOrganizationInvite();
if (orgInvite != null) {
const { policies, isPolicyAndAutoEnrollEnabled, enforcedPasswordPolicyOptions } =
await this.loginService.getPasswordPolicies(orgInvite);
const { policies, isPolicyAndAutoEnrollEnabled, enforcedPasswordPolicyOptions } =
await this.loginService.getOrgPolicies();
this.policies = policies;
this.showResetPasswordAutoEnrollWarning = isPolicyAndAutoEnrollEnabled;
this.enforcedPasswordPolicyOptions = enforcedPasswordPolicyOptions;
}
this.policies = policies;
this.showResetPasswordAutoEnrollWarning = isPolicyAndAutoEnrollEnabled;
this.enforcedPasswordPolicyOptions = enforcedPasswordPolicyOptions;
}
}