From 962bd249740d3682d47e6787816b15002a98d60a Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Mon, 15 Jan 2018 23:28:07 -0500 Subject: [PATCH] safari fix for autofill totp and context menu options --- src/popup/app/current/current.component.ts | 1 + src/popup/app/settings/options.component.html | 2 +- src/popup/app/settings/options.component.ts | 2 ++ src/services/autofill.service.ts | 4 +++- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/popup/app/current/current.component.ts b/src/popup/app/current/current.component.ts index 9d25ab67c9..ac7371cac8 100644 --- a/src/popup/app/current/current.component.ts +++ b/src/popup/app/current/current.component.ts @@ -86,6 +86,7 @@ export class CurrentController { cipher: cipher, pageDetails: this.pageDetails, fromBackground: false, + doc: this.$window.document, }).then((totpCode: string) => { this.$analytics.eventTrack('Autofilled'); if (totpCode && this.platformUtilsService.isFirefox()) { diff --git a/src/popup/app/settings/options.component.html b/src/popup/app/settings/options.component.html index a43275e497..19f9f65b3c 100644 --- a/src/popup/app/settings/options.component.html +++ b/src/popup/app/settings/options.component.html @@ -54,7 +54,7 @@ {{$ctrl.i18n.addLoginNotificationDesc}} -
+
diff --git a/src/popup/app/settings/options.component.ts b/src/popup/app/settings/options.component.ts index f04cf72b3d..49c858ec6d 100644 --- a/src/popup/app/settings/options.component.ts +++ b/src/popup/app/settings/options.component.ts @@ -17,6 +17,7 @@ export class OptionsController { disableAutoTotpCopy = false; disableContextMenuItem = false; disableAddLoginNotification = false; + showDisableContextMenu = true; disableGa = false; i18n: any; @@ -25,6 +26,7 @@ export class OptionsController { private stateService: StateService, private storageService: StorageService, public messagingService: MessagingService, private $timeout: ng.ITimeoutService) { this.i18n = i18nService; + this.showDisableContextMenu = !platformUtilsService.isSafari(); $timeout(() => { PopupUtilsService.initListSectionItemListeners(document, angular); diff --git a/src/services/autofill.service.ts b/src/services/autofill.service.ts index a1a52341af..39103d8b2d 100644 --- a/src/services/autofill.service.ts +++ b/src/services/autofill.service.ts @@ -172,6 +172,7 @@ export default class AutofillService implements AutofillServiceInterface { this.cipherService.updateLastUsedDate(options.cipher.id); } + console.log('fill'); BrowserApi.tabSendMessage(tab, { command: 'fillForm', fillScript: fillScript, @@ -180,6 +181,7 @@ export default class AutofillService implements AutofillServiceInterface { if (options.cipher.type !== CipherType.Login || totpPromise || (options.fromBackground && this.platformUtilsService.isFirefox()) || options.skipTotp || !options.cipher.login.totp || !this.tokenService.getPremium()) { + console.log('return early'); return; } @@ -191,7 +193,7 @@ export default class AutofillService implements AutofillServiceInterface { return null; }).then((code: string) => { if (code) { - UtilsService.copyToClipboard(code); + UtilsService.copyToClipboard(code, options.doc); } return code;