From 35385b8c98d70be9327d5b0aebbc0fe6d9c0f891 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Thu, 18 Jan 2018 15:07:53 -0500 Subject: [PATCH] fixes for duo login on safari --- src/2fa/2fa.ts | 6 +++--- src/popup/app/accounts/accountsLoginTwoFactorController.js | 3 +++ src/popup/app/global/main.controller.ts | 2 ++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/2fa/2fa.ts b/src/2fa/2fa.ts index bc90be29a1..7e7e9c074a 100644 --- a/src/2fa/2fa.ts +++ b/src/2fa/2fa.ts @@ -22,18 +22,18 @@ document.addEventListener('DOMContentLoaded', () => { host: msg.data.host, sig_request: msg.data.signature, submit_callback: (theForm: Document) => { - const sigElement = theForm.querySelector('input[name="sig_response"]'); + const sigElement = theForm.querySelector('input[name="sig_response"]') as HTMLInputElement; if (sigElement) { safari.self.tab.dispatchMessage('bitwarden', { command: '2faPageResponse', type: 'duo', data: { - sigValue: sigElement.nodeValue, + sigValue: sigElement.value, }, }); window.close(); } - } + }, }); } else { // TODO: others like u2f? diff --git a/src/popup/app/accounts/accountsLoginTwoFactorController.js b/src/popup/app/accounts/accountsLoginTwoFactorController.js index aa9ebf8728..8790e837cc 100644 --- a/src/popup/app/accounts/accountsLoginTwoFactorController.js +++ b/src/popup/app/accounts/accountsLoginTwoFactorController.js @@ -123,6 +123,8 @@ angular }); $scope.$on('2faPageResponse', (event, details) => { + console.log('got 2fa response'); + console.log(details); if (details.type === 'duo') { $scope.login(details.data.sigValue); } @@ -167,6 +169,7 @@ angular BrowserApi.tabSendMessage(tabToSend, { command: '2faPageData', data: { + type: 'duo', host: params.Host, signature: params.Signature } diff --git a/src/popup/app/global/main.controller.ts b/src/popup/app/global/main.controller.ts index d8e511f3f1..7e88ea4361 100644 --- a/src/popup/app/global/main.controller.ts +++ b/src/popup/app/global/main.controller.ts @@ -26,6 +26,8 @@ export class MainController implements ng.IController { }); $window.bitwardenPopupMainMessageListener = (msg: any, sender: any, sendResponse: any) => { + console.log(msg); + if (msg.command === 'syncCompleted') { $scope.$broadcast('syncCompleted', msg.successfully); } else if (msg.command === 'syncStarted') {