diff --git a/src/background.js b/src/background.js index ac2f083..c9463a5 100644 --- a/src/background.js +++ b/src/background.js @@ -76,6 +76,7 @@ chrome.runtime.onMessageExternal.addListener(function(request, sender) { // update registry registry[request.settings.tab.id] = { otp: otp, + origin: request.settings.origin, host: request.settings.host }; @@ -92,7 +93,9 @@ chrome.runtime.onMessage.addListener((request, sender, sendResponse) => { case "getToken": if ( registry.hasOwnProperty(request.tabID) && - registry[request.tabID].host === request.host + (registry[request.tabID].origin + ? registry[request.tabID].origin === request.origin + : registry[request.tabID].host === request.host) ) { let otp = registry[request.tabID].otp; let response = { token: otp.generate() }; diff --git a/src/popup/popup.js b/src/popup/popup.js index e77fb81..3b941bc 100644 --- a/src/popup/popup.js +++ b/src/popup/popup.js @@ -102,6 +102,7 @@ function dispatchRequest() { var request = { action: "getToken", tabID: tabs[0].id, + origin: new URL(tabs[0].url).origin, host: new URL(tabs[0].url).hostname }; // request new token