diff --git a/apps/browser/src/_locales/en/messages.json b/apps/browser/src/_locales/en/messages.json
index 1af1cb6638..08e22f5f93 100644
--- a/apps/browser/src/_locales/en/messages.json
+++ b/apps/browser/src/_locales/en/messages.json
@@ -4170,5 +4170,8 @@
},
"systemDefault": {
"message": "System default"
+ },
+ "enterprisePolicyRequirementsApplied": {
+ "message": "Enterprise policy requirements have been applied to this setting"
}
}
diff --git a/apps/browser/src/autofill/popup/settings/autofill.component.html b/apps/browser/src/autofill/popup/settings/autofill.component.html
index 0933bc5421..77f96612c8 100644
--- a/apps/browser/src/autofill/popup/settings/autofill.component.html
+++ b/apps/browser/src/autofill/popup/settings/autofill.component.html
@@ -145,8 +145,12 @@
type="checkbox"
(change)="updateAutofillOnPageLoad()"
[(ngModel)]="enableAutofillOnPageLoad"
+ [disabled]="autofillOnPageLoadFromPolicy$ | async"
/>
{{ "enableAutoFillOnPageLoad" | i18n }}
+ {{
+ "enterprisePolicyRequirementsApplied" | i18n
+ }}
{{ "defaultAutoFillOnPageLoad" | i18n }}
diff --git a/apps/browser/src/autofill/popup/settings/autofill.component.ts b/apps/browser/src/autofill/popup/settings/autofill.component.ts
index 617041a2b1..dc6a4a0880 100644
--- a/apps/browser/src/autofill/popup/settings/autofill.component.ts
+++ b/apps/browser/src/autofill/popup/settings/autofill.component.ts
@@ -87,6 +87,9 @@ export class AutofillComponent implements OnInit {
DisablePasswordManagerUris.Unknown;
protected browserShortcutsURI: BrowserShortcutsUri = BrowserShortcutsUris.Unknown;
protected browserClientIsUnknown: boolean;
+ protected autofillOnPageLoadFromPolicy$ =
+ this.autofillSettingsService.activateAutofillOnPageLoadFromPolicy$;
+
enableAutofillOnPageLoad = false;
enableInlineMenu = false;
enableInlineMenuOnIconSelect = false;
diff --git a/apps/browser/src/autofill/services/abstractions/autofill.service.ts b/apps/browser/src/autofill/services/abstractions/autofill.service.ts
index 9bdb85a3f2..896b9db95c 100644
--- a/apps/browser/src/autofill/services/abstractions/autofill.service.ts
+++ b/apps/browser/src/autofill/services/abstractions/autofill.service.ts
@@ -81,5 +81,6 @@ export abstract class AutofillService {
fromCommand: boolean,
cipherType?: CipherType,
) => Promise;
+ setAutoFillOnPageLoadOrgPolicy: () => Promise;
isPasswordRepromptRequired: (cipher: CipherView, tab: chrome.tabs.Tab) => Promise;
}
diff --git a/apps/browser/src/autofill/services/autofill.service.ts b/apps/browser/src/autofill/services/autofill.service.ts
index d9ae4e9923..c10957b426 100644
--- a/apps/browser/src/autofill/services/autofill.service.ts
+++ b/apps/browser/src/autofill/services/autofill.service.ts
@@ -570,6 +570,19 @@ export default class AutofillService implements AutofillServiceInterface {
return totpCode;
}
+ /**
+ * Activates the autofill on page load org policy.
+ */
+ async setAutoFillOnPageLoadOrgPolicy(): Promise {
+ const autofillOnPageLoadOrgPolicy = await firstValueFrom(
+ this.autofillSettingsService.activateAutofillOnPageLoadFromPolicy$,
+ );
+
+ if (autofillOnPageLoadOrgPolicy) {
+ await this.autofillSettingsService.setAutofillOnPageLoad(true);
+ }
+ }
+
/**
* Gets the active tab from the current window.
* Throws an error if no tab is found.
diff --git a/apps/browser/src/background/runtime.background.ts b/apps/browser/src/background/runtime.background.ts
index 8b216b9a67..660f85617c 100644
--- a/apps/browser/src/background/runtime.background.ts
+++ b/apps/browser/src/background/runtime.background.ts
@@ -228,7 +228,7 @@ export default class RuntimeBackground {
// `getAllDecryptedForUrl` and is anticipated to be refactored
await this.main.refreshBadge();
await this.main.refreshMenu(false);
-
+ await this.autofillService.setAutoFillOnPageLoadOrgPolicy();
break;
}
case "addToLockedVaultPendingNotifications":
@@ -248,6 +248,7 @@ export default class RuntimeBackground {
}, 2000);
await this.configService.ensureConfigFetched();
await this.main.updateOverlayCiphers();
+ await this.autofillService.setAutoFillOnPageLoadOrgPolicy();
}
break;
case "openPopup":
diff --git a/libs/common/src/autofill/services/autofill-settings.service.ts b/libs/common/src/autofill/services/autofill-settings.service.ts
index eb6191d10b..123f69550c 100644
--- a/libs/common/src/autofill/services/autofill-settings.service.ts
+++ b/libs/common/src/autofill/services/autofill-settings.service.ts
@@ -146,9 +146,8 @@ export class AutofillSettingsService implements AutofillSettingsServiceAbstracti
this.autofillOnPageLoadPolicyToastHasDisplayedState = this.stateProvider.getActive(
AUTOFILL_ON_PAGE_LOAD_POLICY_TOAST_HAS_DISPLAYED,
);
- this.autofillOnPageLoadPolicyToastHasDisplayed$ = this.autofillOnPageLoadState.state$.pipe(
- map((x) => x ?? false),
- );
+ this.autofillOnPageLoadPolicyToastHasDisplayed$ =
+ this.autofillOnPageLoadPolicyToastHasDisplayedState.state$.pipe(map((x) => x ?? false));
this.autoCopyTotpState = this.stateProvider.getActive(AUTO_COPY_TOTP);
this.autoCopyTotp$ = this.autoCopyTotpState.state$.pipe(map((x) => x ?? true));