From 690d94d1428ba136311afb3a7ea5689c6108796f Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Fri, 11 Aug 2017 23:41:15 -0400 Subject: [PATCH] copy totp to clipboard before closing popup --- src/popup/app/current/currentController.js | 31 +++++++++++++--------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/src/popup/app/current/currentController.js b/src/popup/app/current/currentController.js index af5bf1827f..20c80e899d 100644 --- a/src/popup/app/current/currentController.js +++ b/src/popup/app/current/currentController.js @@ -83,21 +83,26 @@ angular chrome.tabs.sendMessage(tabId, { command: 'fillForm', fillScript: fillScript - }, { frameId: pageDetails[i].frameId }, $window.close); + }, { frameId: pageDetails[i].frameId }, function () { + if (login.totp && tokenService.getPremium()) { + totpService.isAutoCopyEnabled().then(function (enabled) { + if (enabled) { + return totpService.getCode(login.totp); + } - if (login.totp && tokenService.getPremium()) { - totpService.isAutoCopyEnabled().then(function (enabled) { - if (enabled) { - return totpService.getCode(login.totp); - } + return null; + }).then(function (code) { + if (code) { + utilsService.copyToClipboard(code); + } - return null; - }).then(function (code) { - if (code) { - utilsService.copyToClipboard(code); - } - }); - } + $window.close(); + }); + } + else { + $window.close(); + } + }); } } }