From 7d489af7f3b84b5256353ccfc4ce170f864f64a3 Mon Sep 17 00:00:00 2001 From: Brandon Date: Mon, 3 Nov 2025 12:30:45 -0500 Subject: [PATCH] fix copy, padding, cleanup observable logic --- ...-confirm-edit-policy-dialog.component.html | 2 +- .../auto-confirm-policy.component.html | 6 +-- .../vault/individual-vault/vault.component.ts | 54 ++++++++++++------- apps/web/src/locales/en/messages.json | 14 ++--- .../services/policy/default-policy.service.ts | 2 + 5 files changed, 48 insertions(+), 30 deletions(-) diff --git a/apps/web/src/app/admin-console/organizations/policies/auto-confirm-edit-policy-dialog.component.html b/apps/web/src/app/admin-console/organizations/policies/auto-confirm-edit-policy-dialog.component.html index b85f79f6038..d4b76a39b9f 100644 --- a/apps/web/src/app/admin-console/organizations/policies/auto-confirm-edit-policy-dialog.component.html +++ b/apps/web/src/app/admin-console/organizations/policies/auto-confirm-edit-policy-dialog.component.html @@ -38,7 +38,7 @@
@let showBadge = firstTimeDialog(); @if (showBadge) { - {{ "availableNow" | i18n }} + {{ "availableNow" | i18n }} } {{ (firstTimeDialog ? "autoConfirm" : "editPolicy") | i18n }} diff --git a/apps/web/src/app/admin-console/organizations/policies/policy-edit-definitions/auto-confirm-policy.component.html b/apps/web/src/app/admin-console/organizations/policies/policy-edit-definitions/auto-confirm-policy.component.html index cb6cf5f9bee..9c1f3158e3d 100644 --- a/apps/web/src/app/admin-console/organizations/policies/policy-edit-definitions/auto-confirm-policy.component.html +++ b/apps/web/src/app/admin-console/organizations/policies/policy-edit-definitions/auto-confirm-policy.component.html @@ -47,12 +47,12 @@
    -
  1. 1. {{ "autoConfirmStep1" | i18n }}
  2. +
  3. 1. {{ "autoConfirmExtension1" | i18n }}
  4. - 2. {{ "autoConfirmStep2a" | i18n }} + 2. {{ "autoConfirmExtension2" | i18n }} - {{ "autoConfirmStep2b" | i18n }} + {{ "autoConfirmExtension3" | i18n }}
diff --git a/apps/web/src/app/vault/individual-vault/vault.component.ts b/apps/web/src/app/vault/individual-vault/vault.component.ts index ac000d83e35..22148cc64c5 100644 --- a/apps/web/src/app/vault/individual-vault/vault.component.ts +++ b/apps/web/src/app/vault/individual-vault/vault.component.ts @@ -23,6 +23,7 @@ import { take, takeUntil, tap, + withLatestFrom, } from "rxjs/operators"; import { @@ -642,25 +643,7 @@ export class VaultComponent implements OnInit, OnDestr ); void this.unifiedUpgradePromptService.displayUpgradePromptConditionally(); - zip([ - this.configService.getFeatureFlag$(FeatureFlag.AutoConfirm), - this.userId$.pipe(switchMap((userId) => this.autoConfirmService.configuration$(userId))), - this.organizations$.pipe(map((organizations) => organizations[0])), - ]) - .pipe( - filter( - ([enabled, autoConfirmState, organization]) => - enabled && - autoConfirmState.showSetupDialog && - !!organization && - organization.canManageUsers, - ), - first(), - takeUntil(this.destroy$), - ) - .subscribe(([enabled, autoConfirmState, organization]) => - this.openAutoConfirmFeatureDialog(organization), - ); + this.setupAutoConfirm(); } ngOnDestroy() { @@ -1589,6 +1572,39 @@ export class VaultComponent implements OnInit, OnDestr }, }); } + + private setupAutoConfirm() { + zip([ + this.organizations$.pipe(map((organizations) => organizations[0])), + this.configService.getFeatureFlag$(FeatureFlag.AutoConfirm), + this.userId$.pipe(switchMap((userId) => this.autoConfirmService.configuration$(userId))), + this.userId$.pipe( + switchMap((userId) => this.policyService.policies$(userId)), + withLatestFrom(this.organizations$.pipe(map((organizations) => organizations[0]))), + map(([policies, organization]) => + policies.some( + (p) => + p.type === PolicyType.AutoConfirm && + p.enabled && + p.organizationId === organization.id, + ), + ), + ), + ]) + .pipe( + filter( + ([organization, flagEnabled, autoConfirmState, policyEnabled]) => + flagEnabled && + !policyEnabled && + autoConfirmState.showSetupDialog && + !!organization && + organization.canManageUsers, + ), + first(), + takeUntil(this.destroy$), + ) + .subscribe(([organization]) => this.openAutoConfirmFeatureDialog(organization)); + } } /** diff --git a/apps/web/src/locales/en/messages.json b/apps/web/src/locales/en/messages.json index e91464cb174..d68bbb3231a 100644 --- a/apps/web/src/locales/en/messages.json +++ b/apps/web/src/locales/en/messages.json @@ -5801,16 +5801,16 @@ "howToTurnOnAutoConfirm": { "message": "How to turn on automatic user confirmation" }, - "autoConfirmStep1": { - "message": "Open your Bitwarden extension." + "autoConfirmExtension1": { + "message": "Open your Bitwarden extension" }, - "autoConfirmStep2a": { + "autoConfirmExtension2": { "message": "Select", - "description": "This is a fragment of a larger sencence. The whole sentence will read: 'Select Turn on.'" + "description": "This is a fragment of a larger sencence. The whole sentence will read: 'Select Turn on'" }, - "autoConfirmStep2b": { - "message": " Turn on.", - "description": "This is a fragment of a larger sencence. The whole sentence will read: 'Select Turn on.'" + "autoConfirmExtension3": { + "message": " Turn on", + "description": "This is a fragment of a larger sencence. The whole sentence will read: 'Select Turn on'" }, "autoConfirmExtensionOpened": { "message": "Successfully opened the Bitwarden browser extension. You can now activate the automatic user confirmation setting." diff --git a/libs/common/src/admin-console/services/policy/default-policy.service.ts b/libs/common/src/admin-console/services/policy/default-policy.service.ts index 1107e88e796..b9d7655195b 100644 --- a/libs/common/src/admin-console/services/policy/default-policy.service.ts +++ b/libs/common/src/admin-console/services/policy/default-policy.service.ts @@ -285,6 +285,8 @@ export class DefaultPolicyService implements PolicyService { case PolicyType.RemoveUnlockWithPin: // Remove Unlock with PIN policy return false; + case PolicyType.AutoConfirm: + return false; case PolicyType.OrganizationDataOwnership: // organization data ownership policy applies to everyone except admins and owners return organization.isAdmin;