[PM-5148] Removing Browser Autofill Override Setting and Add Message (#7110)
* [PM-5148] Removing Browser Autofill Override Setting and Add Message * [PM-5148] Removing translation keys * [PM-5148] Removing translation keys * [PM-5148] Modifying how we present the link to users to ensure translations can be more effective
This commit is contained in:
parent
2b3faca86b
commit
e5b8fd4388
|
@ -1033,6 +1033,12 @@
|
|||
"showAutoFillMenuOnFormFieldsDescAlt": {
|
||||
"message": "Applies to all logged in accounts."
|
||||
},
|
||||
"turnOffBrowserBuiltInPasswordManagerSettings": {
|
||||
"message": "Turn off your browser’s built in password manager settings to avoid conflicts."
|
||||
},
|
||||
"turnOffBrowserBuiltInPasswordManagerSettingsLink": {
|
||||
"message": "Edit browser settings."
|
||||
},
|
||||
"autofillOverlayVisibilityOff": {
|
||||
"message": "Off",
|
||||
"description": "Overlay setting select option for disabling autofill overlay"
|
||||
|
@ -2547,36 +2553,12 @@
|
|||
"message": "Bitwarden auto-fill menu available. Press the down arrow key to select.",
|
||||
"description": "Screen reader text for announcing when the overlay opens on the page"
|
||||
},
|
||||
"overrideBrowserAutofillTitle": {
|
||||
"message": "Override browser auto-fill?",
|
||||
"description": "Dialog title facilitating the ability to override a chrome browser's default autofill behavior"
|
||||
},
|
||||
"overrideBrowserAutofillDescription": {
|
||||
"message": "Leaving this setting off may cause conflicts between the Bitwarden auto-fill menu and your browser’s.",
|
||||
"description": "Dialog message facilitating the ability to override a chrome browser's default autofill behavior"
|
||||
},
|
||||
"overrideBrowserAutofillPrivacyRequiredDescription": {
|
||||
"message": "Leaving this setting off may cause conflicts between the Bitwarden auto-fill menu and your browser’s. Turning this on will restart the Bitwarden extension.",
|
||||
"description": "Dialog message facilitating the ability to override a chrome browser's default autofill behavior"
|
||||
},
|
||||
"turnOn": {
|
||||
"message": "Turn on"
|
||||
},
|
||||
"ignore": {
|
||||
"message": "Ignore"
|
||||
},
|
||||
"overrideBrowserAutoFillSettings": {
|
||||
"message": "Override browser auto-fill settings",
|
||||
"description": "Label for the setting that allows overriding the default browser autofill settings"
|
||||
},
|
||||
"extensionPrivacyPermissionNotGrantedTitle": {
|
||||
"message": "Unable to override browser auto-fill",
|
||||
"description": "Title for the dialog that appears when the user has not granted the extension permission to set privacy settings"
|
||||
},
|
||||
"extensionPrivacyPermissionNotGrantedDescription": {
|
||||
"message": "Bitwarden must have access to the extension's privacy permission to override browser auto-fill settings.",
|
||||
"description": "Description for the dialog that appears when the user has not granted the extension permission to set privacy settings"
|
||||
},
|
||||
"importData": {
|
||||
"message": "Import data",
|
||||
"description": "Used for the header of the import dialog, the import button and within the file-password-prompt"
|
||||
|
|
|
@ -45,22 +45,20 @@
|
|||
<div class="box-footer" *ngIf="accountSwitcherEnabled">
|
||||
{{ "showAutoFillMenuOnFormFieldsDescAlt" | i18n }}
|
||||
</div>
|
||||
<div class="box-footer">
|
||||
{{ "turnOffBrowserBuiltInPasswordManagerSettings" | i18n }}
|
||||
<a
|
||||
[attr.href]="disablePasswordManagerLink"
|
||||
(click)="openDisablePasswordManagerLink($event)"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
{{ "turnOffBrowserBuiltInPasswordManagerSettingsLink" | i18n }}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ng-container>
|
||||
<div class="box tw-mt-4" *ngIf="canOverrideBrowserAutofillSetting">
|
||||
<div class="box-content">
|
||||
<div class="box-content-row box-content-row-checkbox" appBoxRow>
|
||||
<label for="overrideBrowserAutofill">{{ "overrideBrowserAutoFillSettings" | i18n }}</label>
|
||||
<input
|
||||
id="overrideBrowserAutofill"
|
||||
type="checkbox"
|
||||
(change)="updateDefaultBrowserAutofillDisabled()"
|
||||
[(ngModel)]="defaultBrowserAutofillDisabled"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box tw-mt-4">
|
||||
<div class="box-content">
|
||||
<div class="box-content-row box-content-row-checkbox" appBoxRow>
|
||||
|
|
|
@ -7,7 +7,6 @@ import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.servic
|
|||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||
import { StateService } from "@bitwarden/common/platform/abstractions/state.service";
|
||||
import { UriMatchType } from "@bitwarden/common/vault/enums";
|
||||
import { DialogService } from "@bitwarden/components";
|
||||
|
||||
import { BrowserApi } from "../../../platform/browser/browser-api";
|
||||
import { flagEnabled } from "../../../platform/flags";
|
||||
|
@ -18,11 +17,10 @@ import { AutofillOverlayVisibility } from "../../utils/autofill-overlay.enum";
|
|||
templateUrl: "autofill.component.html",
|
||||
})
|
||||
export class AutofillComponent implements OnInit {
|
||||
protected canOverrideBrowserAutofillSetting = false;
|
||||
protected defaultBrowserAutofillDisabled = false;
|
||||
protected isAutoFillOverlayFlagEnabled = false;
|
||||
protected autoFillOverlayVisibility: number;
|
||||
protected autoFillOverlayVisibilityOptions: any[];
|
||||
protected disablePasswordManagerLink: string;
|
||||
enableAutoFillOnPageLoad = false;
|
||||
autoFillOnPageLoadDefault = false;
|
||||
autoFillOnPageLoadOptions: any[];
|
||||
|
@ -37,7 +35,6 @@ export class AutofillComponent implements OnInit {
|
|||
private platformUtilsService: PlatformUtilsService,
|
||||
private configService: ConfigServiceAbstraction,
|
||||
private settingsService: SettingsService,
|
||||
private dialogService: DialogService,
|
||||
) {
|
||||
this.autoFillOverlayVisibilityOptions = [
|
||||
{
|
||||
|
@ -67,13 +64,10 @@ export class AutofillComponent implements OnInit {
|
|||
];
|
||||
|
||||
this.accountSwitcherEnabled = flagEnabled("accountSwitching");
|
||||
this.disablePasswordManagerLink = this.getDisablePasswordManagerLink();
|
||||
}
|
||||
|
||||
async ngOnInit() {
|
||||
this.canOverrideBrowserAutofillSetting = this.platformUtilsService.isChrome();
|
||||
|
||||
this.defaultBrowserAutofillDisabled = await this.browserAutofillSettingCurrentlyOverridden();
|
||||
|
||||
this.isAutoFillOverlayFlagEnabled = await this.configService.getFeatureFlag<boolean>(
|
||||
FeatureFlag.AutofillOverlay,
|
||||
);
|
||||
|
@ -91,54 +85,8 @@ export class AutofillComponent implements OnInit {
|
|||
await this.setAutofillKeyboardHelperText(command);
|
||||
}
|
||||
|
||||
async updateDefaultBrowserAutofillDisabled() {
|
||||
const privacyPermissionGranted = await this.privacyPermissionGranted();
|
||||
if (!this.defaultBrowserAutofillDisabled && !privacyPermissionGranted) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (
|
||||
!privacyPermissionGranted &&
|
||||
!(await BrowserApi.requestPermission({ permissions: ["privacy"] }))
|
||||
) {
|
||||
await this.dialogService.openSimpleDialog({
|
||||
title: { key: "extensionPrivacyPermissionNotGrantedTitle" },
|
||||
content: { key: "extensionPrivacyPermissionNotGrantedDescription" },
|
||||
acceptButtonText: { key: "ok" },
|
||||
cancelButtonText: null,
|
||||
type: "warning",
|
||||
});
|
||||
this.defaultBrowserAutofillDisabled = false;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
await BrowserApi.updateDefaultBrowserAutofillSettings(!this.defaultBrowserAutofillDisabled);
|
||||
}
|
||||
|
||||
async updateAutoFillOverlayVisibility() {
|
||||
await this.settingsService.setAutoFillOverlayVisibility(this.autoFillOverlayVisibility);
|
||||
|
||||
if (
|
||||
this.autoFillOverlayVisibility === AutofillOverlayVisibility.Off ||
|
||||
!this.canOverrideBrowserAutofillSetting ||
|
||||
(await this.browserAutofillSettingCurrentlyOverridden())
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
const permissionGranted = await this.privacyPermissionGranted();
|
||||
const contentKey = permissionGranted
|
||||
? "overrideBrowserAutofillDescription"
|
||||
: "overrideBrowserAutofillPrivacyRequiredDescription";
|
||||
await this.dialogService.openSimpleDialog({
|
||||
title: { key: "overrideBrowserAutofillTitle" },
|
||||
content: { key: contentKey },
|
||||
acceptButtonText: { key: "turnOn" },
|
||||
acceptAction: async () => await this.handleOverrideDialogAccept(),
|
||||
cancelButtonText: { key: "ignore" },
|
||||
type: "info",
|
||||
});
|
||||
}
|
||||
|
||||
async updateAutoFillOnPageLoad() {
|
||||
|
@ -175,24 +123,25 @@ export class AutofillComponent implements OnInit {
|
|||
}
|
||||
}
|
||||
|
||||
private handleOverrideDialogAccept = async () => {
|
||||
this.defaultBrowserAutofillDisabled = true;
|
||||
await this.updateDefaultBrowserAutofillDisabled();
|
||||
};
|
||||
|
||||
async browserAutofillSettingCurrentlyOverridden() {
|
||||
if (!this.canOverrideBrowserAutofillSetting) {
|
||||
return false;
|
||||
private getDisablePasswordManagerLink(): string {
|
||||
if (this.platformUtilsService.isChrome()) {
|
||||
return "chrome://settings/autofill";
|
||||
}
|
||||
if (this.platformUtilsService.isOpera()) {
|
||||
return "opera://settings/autofill";
|
||||
}
|
||||
if (this.platformUtilsService.isEdge()) {
|
||||
return "edge://settings/passwords";
|
||||
}
|
||||
if (this.platformUtilsService.isVivaldi()) {
|
||||
return "vivaldi://settings/autofill";
|
||||
}
|
||||
|
||||
if (!(await this.privacyPermissionGranted())) {
|
||||
return false;
|
||||
return "https://bitwarden.com/help/disable-browser-autofill/";
|
||||
}
|
||||
|
||||
return await BrowserApi.browserAutofillSettingsOverridden();
|
||||
}
|
||||
|
||||
async privacyPermissionGranted(): Promise<boolean> {
|
||||
return await BrowserApi.permissionsGranted(["privacy"]);
|
||||
protected openDisablePasswordManagerLink(event: Event) {
|
||||
event.preventDefault();
|
||||
BrowserApi.createNewTab(this.disablePasswordManagerLink);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
"webRequest",
|
||||
"webRequestBlocking"
|
||||
],
|
||||
"optional_permissions": ["nativeMessaging", "privacy"],
|
||||
"optional_permissions": ["nativeMessaging"],
|
||||
"content_security_policy": "script-src 'self' 'wasm-unsafe-eval'; object-src 'self'",
|
||||
"sandbox": {
|
||||
"pages": ["overlay/button.html", "overlay/list.html"],
|
||||
|
|
|
@ -69,7 +69,7 @@
|
|||
"alarms",
|
||||
"scripting"
|
||||
],
|
||||
"optional_permissions": ["nativeMessaging", "privacy"],
|
||||
"optional_permissions": ["nativeMessaging"],
|
||||
"host_permissions": ["http://*/*", "https://*/*"],
|
||||
"content_security_policy": {
|
||||
"extension_pages": "script-src 'self' 'wasm-unsafe-eval'; object-src 'self'",
|
||||
|
|
|
@ -439,33 +439,4 @@ export class BrowserApi {
|
|||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Identifies if the browser autofill settings are overridden by the extension.
|
||||
*/
|
||||
static async browserAutofillSettingsOverridden(): Promise<boolean> {
|
||||
const autofillAddressOverridden: boolean = await new Promise((resolve) =>
|
||||
chrome.privacy.services.autofillAddressEnabled.get({}, (details) =>
|
||||
resolve(details.levelOfControl === "controlled_by_this_extension" && !details.value),
|
||||
),
|
||||
);
|
||||
|
||||
const autofillCreditCardOverridden: boolean = await new Promise((resolve) =>
|
||||
chrome.privacy.services.autofillCreditCardEnabled.get({}, (details) =>
|
||||
resolve(details.levelOfControl === "controlled_by_this_extension" && !details.value),
|
||||
),
|
||||
);
|
||||
|
||||
return autofillAddressOverridden && autofillCreditCardOverridden;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the browser autofill settings to the given value.
|
||||
*
|
||||
* @param value - Determines whether to enable or disable the autofill settings.
|
||||
*/
|
||||
static async updateDefaultBrowserAutofillSettings(value: boolean) {
|
||||
chrome.privacy.services.autofillAddressEnabled.set({ value });
|
||||
chrome.privacy.services.autofillCreditCardEnabled.set({ value });
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue