From de809136a28efd54db7e2fd1091bf13b1a8a84c4 Mon Sep 17 00:00:00 2001 From: Tom Rittson Date: Sun, 25 Oct 2020 14:34:38 +1000 Subject: [PATCH 01/11] add UI for new autofill on page load options --- src/_locales/en/messages.json | 12 ++++++++++++ src/popup/vault/add-edit.component.html | 6 ++++++ 2 files changed, 18 insertions(+) diff --git a/src/_locales/en/messages.json b/src/_locales/en/messages.json index 8665d2c325..c04c127744 100644 --- a/src/_locales/en/messages.json +++ b/src/_locales/en/messages.json @@ -888,6 +888,18 @@ "enableAutoFillOnPageLoadDesc": { "message": "If a login form is detected, automatically perform an auto-fill when the web page loads." }, + "autoFillOnPageLoad": { + "message": "Auto-fill On Page Load" + }, + "autoFillOnPageLoadUseGlobalSettings": { + "message": "Use Global Settings" + }, + "autoFillOnPageLoadAlways": { + "message": "Always" + }, + "autoFillOnPageLoadNever": { + "message": "Never" + }, "experimentalFeature": { "message": "This is currently an experimental feature. Use at your own risk." }, diff --git a/src/popup/vault/add-edit.component.html b/src/popup/vault/add-edit.component.html index eba3c193cc..fcf3c48b7d 100644 --- a/src/popup/vault/add-edit.component.html +++ b/src/popup/vault/add-edit.component.html @@ -261,6 +261,12 @@
+
+ + +
-
+
+
+ + +
+
-
+
diff --git a/src/popup/settings/options.component.ts b/src/popup/settings/options.component.ts index e5cf6322bb..5dbc9c3d6e 100644 --- a/src/popup/settings/options.component.ts +++ b/src/popup/settings/options.component.ts @@ -23,6 +23,8 @@ import { ConstantsService } from 'jslib/services/constants.service'; export class OptionsComponent implements OnInit { disableFavicon = false; enableAutoFillOnPageLoad = false; + autoFillOnPageLoadDefault = false; + autoFillOnPageLoadOptions: any[]; disableAutoTotpCopy = false; disableContextMenuItem = false; disableAddLoginNotification = false; @@ -64,6 +66,10 @@ export class OptionsComponent implements OnInit { { name: i18nService.t('twoMinutes'), value: 120 }, { name: i18nService.t('fiveMinutes'), value: 300 }, ]; + this.autoFillOnPageLoadOptions = [ + { name: i18nService.t('globalAutoFillOnPageLoadAlways'), value: true }, + { name: i18nService.t('globalAutoFillOnPageLoadNever'), value: false }, + ] } async ngOnInit() { diff --git a/src/popup/vault/add-edit.component.html b/src/popup/vault/add-edit.component.html index 11cfbaf4d1..7650adc560 100644 --- a/src/popup/vault/add-edit.component.html +++ b/src/popup/vault/add-edit.component.html @@ -259,18 +259,15 @@
-
+
- +
-
From 16f726738d82f4892f37baf48ac07686c3963067 Mon Sep 17 00:00:00 2001 From: Thomas Rittson Date: Fri, 16 Apr 2021 13:46:56 +1000 Subject: [PATCH 06/11] Update UI strings, remove autofillOnPageLoad enum --- src/_locales/en/messages.json | 20 +++++++------------- src/content/autofiller.ts | 8 ++++++-- src/popup/settings/options.component.html | 2 +- src/popup/settings/options.component.ts | 11 +++++++++-- 4 files changed, 23 insertions(+), 18 deletions(-) diff --git a/src/_locales/en/messages.json b/src/_locales/en/messages.json index 1228822a8c..0adf252307 100644 --- a/src/_locales/en/messages.json +++ b/src/_locales/en/messages.json @@ -892,25 +892,19 @@ "message": "This is currently an experimental feature. Use at your own risk." }, "defaultAutoFillOnPageLoad": { - "message": "Default auto-fill on page load setting" - }, - "globalAutoFillOnPageLoadAlways": { - "message": "Always auto-fill" - }, - "globalAutoFillOnPageLoadNever": { - "message": "Never auto-fill" + "message": "Default login setting" }, "itemAutoFillOnPageLoad": { - "message": "Auto-fill On Page Load (if enabled)" + "message": "Auto-fill On Page Load (if enabled in Options)" }, - "itemAutoFillOnPageLoadUseGlobal": { + "autoFillOnPageLoadUseDefault": { "message": "Use default setting" }, - "itemAutoFillOnPageLoadAlways": { - "message": "Always auto-fill this login" + "autoFillOnPageLoadYes": { + "message": "Auto-fill" }, - "itemAutoFillOnPageLoadNever": { - "message": "Never auto-fill this login" + "autoFillOnPageLoadNo": { + "message": "Do not auto-fill" }, "commandOpenPopup": { "message": "Open vault popup" diff --git a/src/content/autofiller.ts b/src/content/autofiller.ts index 2a1af3c8d2..5e73c4a5c5 100644 --- a/src/content/autofiller.ts +++ b/src/content/autofiller.ts @@ -3,8 +3,12 @@ document.addEventListener('DOMContentLoaded', event => { let filledThisHref = false; let delayFillTimeout: number; - setInterval(() => doFillIfNeeded(), 500); - + const enabledKey = 'enableAutoFillOnPageLoad'; + chrome.storage.local.get(enabledKey, (obj: any) => { + if (obj != null && obj[enabledKey] === true) { + setInterval(() => doFillIfNeeded(), 500); + } + }); chrome.runtime.onMessage.addListener((msg: any, sender: any, sendResponse: Function) => { if (msg.command === 'fillForm' && pageHref === msg.url) { filledThisHref = true; diff --git a/src/popup/settings/options.component.html b/src/popup/settings/options.component.html index e41bcb607f..13b7c6d2d7 100644 --- a/src/popup/settings/options.component.html +++ b/src/popup/settings/options.component.html @@ -25,7 +25,7 @@
diff --git a/src/popup/settings/options.component.ts b/src/popup/settings/options.component.ts index 5dbc9c3d6e..7222c20b9e 100644 --- a/src/popup/settings/options.component.ts +++ b/src/popup/settings/options.component.ts @@ -67,14 +67,17 @@ export class OptionsComponent implements OnInit { { name: i18nService.t('fiveMinutes'), value: 300 }, ]; this.autoFillOnPageLoadOptions = [ - { name: i18nService.t('globalAutoFillOnPageLoadAlways'), value: true }, - { name: i18nService.t('globalAutoFillOnPageLoadNever'), value: false }, + { name: i18nService.t('autoFillOnPageLoadYes'), value: true }, + { name: i18nService.t('autoFillOnPageLoadNo'), value: false }, ] } async ngOnInit() { this.enableAutoFillOnPageLoad = await this.storageService.get( ConstantsService.enableAutoFillOnPageLoadKey); + + this.autoFillOnPageLoadDefault = await this.storageService.get( + ConstantsService.autoFillOnPageLoadDefaultKey) ?? false; this.disableAddLoginNotification = await this.storageService.get( ConstantsService.disableAddLoginNotificationKey); @@ -129,6 +132,10 @@ export class OptionsComponent implements OnInit { this.callAnalytics('Auto-fill Page Load', this.enableAutoFillOnPageLoad); } + async updateAutoFillOnPageLoadDefault() { + await this.storageService.save(ConstantsService.autoFillOnPageLoadDefaultKey, this.autoFillOnPageLoadDefault); + } + async updateDisableFavicon() { await this.storageService.save(ConstantsService.disableFaviconKey, this.disableFavicon); await this.stateService.save(ConstantsService.disableFaviconKey, this.disableFavicon); From 998f633210b102763ea8fdab6ab3bc6b84284813 Mon Sep 17 00:00:00 2001 From: Thomas Rittson Date: Fri, 14 May 2021 11:23:46 +1000 Subject: [PATCH 07/11] Update UI per Options page redesign --- src/_locales/en/messages.json | 9 ++++++--- src/popup/scss/box.scss | 15 --------------- src/popup/settings/options.component.html | 12 ++++++++++++ 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/_locales/en/messages.json b/src/_locales/en/messages.json index 69fb44bc02..0e446be9bd 100644 --- a/src/_locales/en/messages.json +++ b/src/_locales/en/messages.json @@ -908,7 +908,10 @@ "message": "This is currently an experimental feature. Use at your own risk." }, "defaultAutoFillOnPageLoad": { - "message": "Default login setting" + "message": "Default autofill setting for login items" + }, + "defaultAutoFillOnPageLoadDesc": { + "message": "After enabling Auto-fill On Page Load, you can enable or disable the feature for individual login items. This is the default setting for login items that are not separately configured." }, "itemAutoFillOnPageLoad": { "message": "Auto-fill On Page Load (if enabled in Options)" @@ -917,10 +920,10 @@ "message": "Use default setting" }, "autoFillOnPageLoadYes": { - "message": "Auto-fill" + "message": "Auto-fill on page load" }, "autoFillOnPageLoadNo": { - "message": "Do not auto-fill" + "message": "Do not auto-fill on page load" }, "commandOpenPopup": { "message": "Open vault popup" diff --git a/src/popup/scss/box.scss b/src/popup/scss/box.scss index 47648a36db..f53719af1e 100644 --- a/src/popup/scss/box.scss +++ b/src/popup/scss/box.scss @@ -77,21 +77,6 @@ @include themify($themes) { color: themed('mutedColor'); } - - .sub-option { - margin-right: 5px; - margin-top: 10px; - display: flex; - justify-content: space-between; - - select { - border: 1px solid #000000; - border-radius: $border-radius; - @include themify($themes) { - border-color: themed('boxBackgroundColor'); - } - } - } } &.list { diff --git a/src/popup/settings/options.component.html b/src/popup/settings/options.component.html index fd7563a12d..fbb2f43110 100644 --- a/src/popup/settings/options.component.html +++ b/src/popup/settings/options.component.html @@ -173,5 +173,17 @@ {{'enableAutoTotpCopyOnAutoFillDesc' | i18n}}
+
+
+
+ + +
+
+ +
From 655877f75ffd77db90f65a14b53401ff2fadde2c Mon Sep 17 00:00:00 2001 From: Thomas Rittson Date: Fri, 14 May 2021 11:26:16 +1000 Subject: [PATCH 08/11] reorder UI --- src/popup/settings/options.component.html | 24 +++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/popup/settings/options.component.html b/src/popup/settings/options.component.html index fbb2f43110..ebcd86eabb 100644 --- a/src/popup/settings/options.component.html +++ b/src/popup/settings/options.component.html @@ -161,18 +161,6 @@ {{'warning' | i18n}}: {{'experimentalFeature' | i18n}}
-
-
-
- - -
-
- -
@@ -185,5 +173,17 @@
+
+
+
+ + +
+
+ +
From d4055a7613dd9eab04633142582c25a0cbaf7185 Mon Sep 17 00:00:00 2001 From: Thomas Rittson Date: Mon, 17 May 2021 13:46:39 +1000 Subject: [PATCH 09/11] Only show autofill options if enabled --- src/popup/vault/add-edit.component.html | 2 +- src/popup/vault/add-edit.component.ts | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/popup/vault/add-edit.component.html b/src/popup/vault/add-edit.component.html index b759e9bcbb..d7b3efaab7 100644 --- a/src/popup/vault/add-edit.component.html +++ b/src/popup/vault/add-edit.component.html @@ -268,7 +268,7 @@
-
+
diff --git a/src/popup/vault/add-edit.component.ts b/src/popup/vault/add-edit.component.ts index d6f5bd7339..ca3539ad95 100644 --- a/src/popup/vault/add-edit.component.ts +++ b/src/popup/vault/add-edit.component.ts @@ -24,6 +24,9 @@ import { PopupUtilsService } from '../services/popup-utils.service'; import { LoginUriView } from 'jslib/models/view/loginUriView'; import { AddEditComponent as BaseAddEditComponent } from 'jslib/angular/components/add-edit.component'; +import { StorageService } from 'jslib/abstractions'; +import { ConstantsService } from 'jslib/services'; +import { CipherType } from 'jslib/enums'; @Component({ selector: 'app-vault-add-edit', @@ -33,6 +36,7 @@ export class AddEditComponent extends BaseAddEditComponent { currentUris: string[]; showAttachments = true; openAttachmentsInPopup: boolean; + showAutoFillOnPageLoadOptions: boolean; constructor(cipherService: CipherService, folderService: FolderService, i18nService: I18nService, platformUtilsService: PlatformUtilsService, @@ -41,7 +45,7 @@ export class AddEditComponent extends BaseAddEditComponent { messagingService: MessagingService, private route: ActivatedRoute, private router: Router, private location: Location, eventService: EventService, policyService: PolicyService, - private popupUtilsService: PopupUtilsService) { + private popupUtilsService: PopupUtilsService, private storageService: StorageService) { super(cipherService, folderService, i18nService, platformUtilsService, auditService, stateService, userService, collectionService, messagingService, eventService, policyService); } @@ -106,6 +110,9 @@ export class AddEditComponent extends BaseAddEditComponent { } } }, 200); + + this.showAutoFillOnPageLoadOptions = this.cipher.type === CipherType.Login && + await this.storageService.get(ConstantsService.enableAutoFillOnPageLoadKey); } async submit(): Promise { From df8a253a7d524ff00e3a5821bb776ff48952a2e3 Mon Sep 17 00:00:00 2001 From: Thomas Rittson Date: Mon, 17 May 2021 14:32:48 +1000 Subject: [PATCH 10/11] fix linting, minor bugfix --- src/popup/vault/add-edit.component.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/popup/vault/add-edit.component.ts b/src/popup/vault/add-edit.component.ts index ca3539ad95..b717e8cb0a 100644 --- a/src/popup/vault/add-edit.component.ts +++ b/src/popup/vault/add-edit.component.ts @@ -18,15 +18,16 @@ import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service'; import { PolicyService } from 'jslib/abstractions/policy.service'; import { StateService } from 'jslib/abstractions/state.service'; import { UserService } from 'jslib/abstractions/user.service'; +import { StorageService } from 'jslib/abstractions/storage.service'; import { PopupUtilsService } from '../services/popup-utils.service'; +import { ConstantsService } from 'jslib/services/constants.service'; import { LoginUriView } from 'jslib/models/view/loginUriView'; import { AddEditComponent as BaseAddEditComponent } from 'jslib/angular/components/add-edit.component'; -import { StorageService } from 'jslib/abstractions'; -import { ConstantsService } from 'jslib/services'; -import { CipherType } from 'jslib/enums'; + +import { CipherType } from 'jslib/enums/cipherType'; @Component({ selector: 'app-vault-add-edit', @@ -110,7 +111,10 @@ export class AddEditComponent extends BaseAddEditComponent { } } }, 200); + } + async load() { + await super.load(); this.showAutoFillOnPageLoadOptions = this.cipher.type === CipherType.Login && await this.storageService.get(ConstantsService.enableAutoFillOnPageLoadKey); } From a49a1e512d1a8975e04234b91da66b612585b22a Mon Sep 17 00:00:00 2001 From: Thomas Rittson Date: Tue, 18 May 2021 10:12:01 +1000 Subject: [PATCH 11/11] bump jslib --- jslib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jslib b/jslib index 8659d0975d..3d4ecaeb6a 160000 --- a/jslib +++ b/jslib @@ -1 +1 @@ -Subproject commit 8659d0975ddb7dc70c0246b4b9acf81e013cdde3 +Subproject commit 3d4ecaeb6aa5a09c74ce23ee526499f408aee02d