diff --git a/apps/web/src/app/admin-console/organizations/settings/two-factor-setup.component.ts b/apps/web/src/app/admin-console/organizations/settings/two-factor-setup.component.ts index f94ad051009..1a456e3f544 100644 --- a/apps/web/src/app/admin-console/organizations/settings/two-factor-setup.component.ts +++ b/apps/web/src/app/admin-console/organizations/settings/two-factor-setup.component.ts @@ -1,8 +1,11 @@ import { Component } from "@angular/core"; import { ActivatedRoute } from "@angular/router"; +import { concatMap, takeUntil } from "rxjs"; +import { tap } from "rxjs/operators"; import { ModalService } from "@bitwarden/angular/services/modal.service"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; +import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction"; import { PolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction"; import { TwoFactorProviderType } from "@bitwarden/common/auth/enums/two-factor-provider-type"; import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service"; @@ -24,17 +27,23 @@ export class TwoFactorSetupComponent extends BaseTwoFactorSetupComponent { messagingService: MessagingService, policyService: PolicyService, private route: ActivatedRoute, - stateService: StateService + stateService: StateService, + private organizationService: OrganizationService ) { super(apiService, modalService, messagingService, policyService, stateService); } async ngOnInit() { - // eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe - this.route.parent.parent.params.subscribe(async (params) => { - this.organizationId = params.organizationId; - await super.ngOnInit(); - }); + this.route.params + .pipe( + tap((params) => { + this.organizationId = params.organizationId; + this.organization = this.organizationService.get(this.organizationId); + }), + concatMap(async () => await super.ngOnInit()), + takeUntil(this.destroy$) + ) + .subscribe(); } async manage(type: TwoFactorProviderType) { @@ -43,8 +52,7 @@ export class TwoFactorSetupComponent extends BaseTwoFactorSetupComponent { const duoComp = await this.openModal(this.duoModalRef, TwoFactorDuoComponent); duoComp.type = TwoFactorProviderType.OrganizationDuo; duoComp.organizationId = this.organizationId; - // eslint-disable-next-line rxjs-angular/prefer-takeuntil - duoComp.onUpdated.subscribe((enabled: boolean) => { + duoComp.onUpdated.pipe(takeUntil(this.destroy$)).subscribe((enabled: boolean) => { this.updateStatus(enabled, TwoFactorProviderType.OrganizationDuo); }); break; diff --git a/apps/web/src/app/auth/settings/two-factor-setup.component.html b/apps/web/src/app/auth/settings/two-factor-setup.component.html index 7e60a4ecaa6..b7d002c0821 100644 --- a/apps/web/src/app/auth/settings/two-factor-setup.component.html +++ b/apps/web/src/app/auth/settings/two-factor-setup.component.html @@ -1,16 +1,25 @@
{{ "twoStepLoginDesc" | i18n }}
- {{ "twoStepLoginOrganizationDescStart" | i18n }}
- {{ "twoStepLoginPolicy" | i18n }}.
- {{ "twoStepLoginOrganizationSsoDesc" | i18n }}
- {{ "twoStepLoginOrganizationDuoDesc" | i18n }}
+
+ {{ "twoStepLoginOrganizationDuoDesc" | i18n }}
+
+
+
+ {{ "twoStepLoginOrganizationDuoDesc" | i18n }}
+
{{ "twoStepLoginOrganizationSsoDesc" | i18n }}
{{ "twoStepLoginRecoveryWarning" | i18n }}
diff --git a/apps/web/src/app/auth/settings/two-factor-setup.component.ts b/apps/web/src/app/auth/settings/two-factor-setup.component.ts index 856801a176f..44955347b5c 100644 --- a/apps/web/src/app/auth/settings/two-factor-setup.component.ts +++ b/apps/web/src/app/auth/settings/two-factor-setup.component.ts @@ -6,8 +6,10 @@ import { ModalService } from "@bitwarden/angular/services/modal.service"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { PolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction"; import { PolicyType } from "@bitwarden/common/admin-console/enums"; +import { Organization } from "@bitwarden/common/admin-console/models/domain/organization"; import { TwoFactorProviderType } from "@bitwarden/common/auth/enums/two-factor-provider-type"; import { TwoFactorProviders } from "@bitwarden/common/auth/services/two-factor.service"; +import { ProductType } from "@bitwarden/common/enums"; import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service"; import { StateService } from "@bitwarden/common/platform/abstractions/state.service"; @@ -36,6 +38,7 @@ export class TwoFactorSetupComponent implements OnInit, OnDestroy { webAuthnModalRef: ViewContainerRef; organizationId: string; + organization: Organization; providers: any[] = []; canAccessPremium: boolean; showPolicyWarning = false; @@ -45,7 +48,7 @@ export class TwoFactorSetupComponent implements OnInit, OnDestroy { tabbedHeader = true; - private destroy$ = new Subject