diff --git a/jslib b/jslib index a72c8a60c1..2841cff90a 160000 --- a/jslib +++ b/jslib @@ -1 +1 @@ -Subproject commit a72c8a60c1b7a6980bceee456c53a9ea7b9b3451 +Subproject commit 2841cff90a8ff8136b5d580443725be792521bea diff --git a/src/_locales/en/messages.json b/src/_locales/en/messages.json index 4beda13991..19b29592f5 100644 --- a/src/_locales/en/messages.json +++ b/src/_locales/en/messages.json @@ -898,6 +898,12 @@ "enableAutoFillOnPageLoadDesc": { "message": "If a login form is detected, automatically perform an auto-fill when the web page loads." }, + "enableAutoTotpCopyOnAutoFill": { + "message": "Automatic TOTP Copy after Page Load" + }, + "enableAutoTotpCopyOnAutoFillDesc": { + "message": "If Auto-fill On Page Load is enabled, and your login has an authenticator key attached to it, the TOTP verification code is automatically copied to your clipboard after loading the web page." + }, "experimentalFeature": { "message": "This is currently an experimental feature. Use at your own risk." }, diff --git a/src/popup/settings/options.component.html b/src/popup/settings/options.component.html index d0888604d9..8d82dfc5ed 100644 --- a/src/popup/settings/options.component.html +++ b/src/popup/settings/options.component.html @@ -24,6 +24,18 @@ {{'warning' | i18n}}: {{'experimentalFeature' | i18n}} +
+
+
+ + +
+
+ +
diff --git a/src/popup/settings/options.component.ts b/src/popup/settings/options.component.ts index 6ac0158be2..abe528f15d 100644 --- a/src/popup/settings/options.component.ts +++ b/src/popup/settings/options.component.ts @@ -22,6 +22,7 @@ export class OptionsComponent implements OnInit { disableFavicon = false; disableBadgeCounter = false; enableAutoFillOnPageLoad = false; + enableAutoTotpCopyOnAutoFill = false; disableAutoTotpCopy = false; disableContextMenuItem = false; disableAddLoginNotification = false; @@ -68,6 +69,8 @@ export class OptionsComponent implements OnInit { this.enableAutoFillOnPageLoad = await this.storageService.get( ConstantsService.enableAutoFillOnPageLoadKey); + this.enableAutoTotpCopyOnAutoFill = await this.totpService.isAutoCopyOnAutoFillEnabled(); + this.disableAddLoginNotification = await this.storageService.get( ConstantsService.disableAddLoginNotificationKey); @@ -118,6 +121,10 @@ export class OptionsComponent implements OnInit { await this.storageService.save(ConstantsService.enableAutoFillOnPageLoadKey, this.enableAutoFillOnPageLoad); } + async updateAutoTotpCopyOnAutoFill() { + await this.storageService.save(ConstantsService.enableAutoTotpCopyOnAutoFillKey, this.enableAutoTotpCopyOnAutoFill); + } + async updateDisableFavicon() { await this.storageService.save(ConstantsService.disableFaviconKey, this.disableFavicon); await this.stateService.save(ConstantsService.disableFaviconKey, this.disableFavicon); diff --git a/src/services/autofill.service.ts b/src/services/autofill.service.ts index f75e4a5d95..f61236b569 100644 --- a/src/services/autofill.service.ts +++ b/src/services/autofill.service.ts @@ -258,11 +258,14 @@ export default class AutofillService implements AutofillServiceInterface { if (cipher.reprompt !== CipherRepromptType.None) { return; } - + + const copyTotpOnAutoFill = await this.totpService.isAutoCopyOnAutoFillEnabled(); + const shouldCopyTotp = fromCommand || copyTotpOnAutoFill; + const totpCode = await this.doAutoFill({ cipher: cipher, pageDetails: pageDetails, - skipTotp: !fromCommand, + skipTotp: !shouldCopyTotp, skipLastUsed: !fromCommand, skipUsernameOnlyFill: !fromCommand, onlyEmptyFields: !fromCommand,