diff options
author | cglatot <[email protected]> | 2020-10-08 18:43:42 +0100 |
---|---|---|
committer | cglatot <[email protected]> | 2020-10-08 18:43:42 +0100 |
commit | f17dd9201ae4e609dc817ae79ade729442213036 (patch) | |
tree | 2b0137dbab5c9a7b1bb817aea2a02c2308d1b236 | |
parent | d862a743f8554a6e7739a9696d4d000e8be6920d (diff) | |
parent | 4cb8e38cb72ddd6e57841ce609a8ddee55b90d4f (diff) | |
download | pasta-f17dd9201ae4e609dc817ae79ade729442213036.tar.gz pasta-f17dd9201ae4e609dc817ae79ade729442213036.zip |
Merge branch 'master' into https-server-connections
-rw-r--r-- | js/main.js | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -166,9 +166,9 @@ function authenticateWithPlex() { $('#waitOnPinAuth').show(); $('#loginWithPlexBtn').hide(); - window.open(authAppUrl, 'PlexSignIn', 'width=800,height=730'); + let popupWindow = window.open(authAppUrl, 'PlexSignIn', 'width=800,height=730'); backOffTimer = Date.now(); - listenForValidPincode(data.id, clientIdentifier, data.code); + listenForValidPincode(data.id, clientIdentifier, data.code, popupWindow); }, "error": (data) => { console.log("ERROR L121"); @@ -177,7 +177,7 @@ function authenticateWithPlex() { }); } -function listenForValidPincode(pinId, clientId, pinCode) { +function listenForValidPincode(pinId, clientId, pinCode, popWindow) { let currentTime = Date.now(); if ((currentTime - backOffTimer)/1000 < 180) { $.ajax({ @@ -196,9 +196,10 @@ function listenForValidPincode(pinId, clientId, pinCode) { localStorage.pinAuthToken = data.authToken; plexToken = data.authToken; checkIfAuthTokenIsValid(); + popWindow.close(); } else { setTimeout(() => { - listenForValidPincode(pinId, clientId, pinCode); + listenForValidPincode(pinId, clientId, pinCode, popWindow); }, 3000); // Check every 3 seconds } }, |