aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorcglatot <[email protected]>2020-10-08 18:43:42 +0100
committercglatot <[email protected]>2020-10-08 18:43:42 +0100
commitf17dd9201ae4e609dc817ae79ade729442213036 (patch)
tree2b0137dbab5c9a7b1bb817aea2a02c2308d1b236
parentd862a743f8554a6e7739a9696d4d000e8be6920d (diff)
parent4cb8e38cb72ddd6e57841ce609a8ddee55b90d4f (diff)
downloadpasta-f17dd9201ae4e609dc817ae79ade729442213036.tar.gz
pasta-f17dd9201ae4e609dc817ae79ade729442213036.zip
Merge branch 'master' into https-server-connections
-rw-r--r--js/main.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/js/main.js b/js/main.js
index 181b904..2c069dd 100644
--- a/js/main.js
+++ b/js/main.js
@@ -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
}
},