diff --git a/apps/web/src/app/auth/settings/account/danger-zone.component.html b/apps/web/src/app/auth/settings/account/danger-zone.component.html index 14c3b7e0b7..1e7c73a3cc 100644 --- a/apps/web/src/app/auth/settings/account/danger-zone.component.html +++ b/apps/web/src/app/auth/settings/account/danger-zone.component.html @@ -1,9 +1,15 @@

{{ "dangerZone" | i18n }}

-

{{ "dangerZoneDesc" | i18n }}

+

+ {{ + (accountDeprovisioningEnabled$ | async) && content.children.length === 1 + ? ("dangerZoneDescSingular" | i18n) + : ("dangerZoneDesc" | i18n) + }} +

-
+
diff --git a/apps/web/src/app/auth/settings/account/danger-zone.component.ts b/apps/web/src/app/auth/settings/account/danger-zone.component.ts index 42f198f4f0..4d1adddd18 100644 --- a/apps/web/src/app/auth/settings/account/danger-zone.component.ts +++ b/apps/web/src/app/auth/settings/account/danger-zone.component.ts @@ -1,6 +1,10 @@ -import { Component } from "@angular/core"; +import { CommonModule } from "@angular/common"; +import { Component, OnInit } from "@angular/core"; +import { Observable } from "rxjs"; import { JslibModule } from "@bitwarden/angular/jslib.module"; +import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum"; +import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service"; import { TypographyModule } from "@bitwarden/components"; /** @@ -10,6 +14,15 @@ import { TypographyModule } from "@bitwarden/components"; selector: "app-danger-zone", templateUrl: "danger-zone.component.html", standalone: true, - imports: [TypographyModule, JslibModule], + imports: [TypographyModule, JslibModule, CommonModule], }) -export class DangerZoneComponent {} +export class DangerZoneComponent implements OnInit { + constructor(private configService: ConfigService) {} + accountDeprovisioningEnabled$: Observable; + + ngOnInit(): void { + this.accountDeprovisioningEnabled$ = this.configService.getFeatureFlag$( + FeatureFlag.AccountDeprovisioning, + ); + } +} diff --git a/apps/web/src/app/auth/settings/account/profile.component.html b/apps/web/src/app/auth/settings/account/profile.component.html index 93025420b2..e6b6980733 100644 --- a/apps/web/src/app/auth/settings/account/profile.component.html +++ b/apps/web/src/app/auth/settings/account/profile.component.html @@ -36,6 +36,12 @@ Customize
+
+ {{ "accountIsManagedMessage" | i18n: managingOrganization?.name }} + + + +
; private destroy$ = new Subject(); protected formGroup = new FormGroup({ @@ -32,6 +37,8 @@ export class ProfileComponent implements OnInit, OnDestroy { private accountService: AccountService, private dialogService: DialogService, private toastService: ToastService, + private configService: ConfigService, + private organizationService: OrganizationService, ) {} async ngOnInit() { @@ -40,6 +47,19 @@ export class ProfileComponent implements OnInit, OnDestroy { this.fingerprintMaterial = await firstValueFrom( this.accountService.activeAccount$.pipe(map((a) => a?.id)), ); + this.managingOrganization$ = this.configService + .getFeatureFlag$(FeatureFlag.AccountDeprovisioning) + .pipe( + switchMap((isAccountDeprovisioningEnabled) => + isAccountDeprovisioningEnabled + ? this.organizationService.organizations$.pipe( + map((organizations) => + organizations.find((o) => o.userIsManagedByOrganization === true), + ), + ) + : of(null), + ), + ); this.formGroup.get("name").setValue(this.profile.name); this.formGroup.get("email").setValue(this.profile.email); diff --git a/apps/web/src/locales/en/messages.json b/apps/web/src/locales/en/messages.json index aa7bce0431..277f834c69 100644 --- a/apps/web/src/locales/en/messages.json +++ b/apps/web/src/locales/en/messages.json @@ -1713,6 +1713,9 @@ "dangerZoneDesc": { "message": "Careful, these actions are not reversible!" }, + "dangerZoneDescSingular": { + "message": "Careful, this action is not reversible!" + }, "deauthorizeSessions": { "message": "Deauthorize sessions" }, @@ -1725,6 +1728,15 @@ "sessionsDeauthorized": { "message": "All sessions deauthorized" }, + "accountIsManagedMessage": { + "message": "This account is managed by $ORGANIZATIONNAME$", + "placeholders": { + "organizationName": { + "content": "$1", + "example": "Organization" + } + } + }, "purgeVault": { "message": "Purge vault" },