X-Git-Url: https://git-public.kairo.at/?a=blobdiff_plain;f=js%2Fui.js;h=63751015851684393209f7372f911096ac09003e;hb=b5291db1cf7dff0d45dc632de2b7b4d377b5db97;hp=263a139387e3ff37a45b43e290cca2cbced159e0;hpb=5e9f4a24c890ea34a762380ac01d76648a8547e5;p=lantea.git diff --git a/js/ui.js b/js/ui.js index 263a139..6375101 100644 --- a/js/ui.js +++ b/js/ui.js @@ -17,11 +17,6 @@ var gBackendURL = "https://backend.lantea.kairo.at"; var gAuthClientID = "lantea"; window.onload = function() { - if (/\/login\.html/.test(window.location)) { - // If we are in the login window, call a function to complete the process and don't do anything else here. - completeLoginWindow(); - return; - } gAction = document.getElementById("action"); gActionLabel = document.getElementById("actionlabel"); @@ -175,16 +170,6 @@ function prepareLoginButton(aCallback) { ); } -function completeLoginWindow() { - if (window.opener) { - window.opener.finishLogin(getParameterByName("code"), getParameterByName("state")); - window.close(); - } - else { - document.getElementById("logininfo").textContent = "You have called this document outside of the login flow, which is not supported."; - } -} - function finishLogin(aCode, aState) { if (aState == authData["state"]) { fetchBackend("login?code=" + aCode + "&state=" + aState + "&redirect_uri=" + encodeURIComponent(getRedirectURI()), "GET", null, @@ -543,7 +528,7 @@ function reportUploadStatus(aSuccess, aResponse) { if (aSuccess) { document.getElementById("uploadSuccess").style.display = "block"; } - else if (aResponse["message"]) { + else if (aResponse && aResponse["message"]) { document.getElementById("uploadErrorMsg").textContent = aResponse["message"]; if (aResponse["errortype"]) { document.getElementById("uploadErrorMsg").textContent += " (" + aResponse["errortype"] + ")"; @@ -729,11 +714,3 @@ function fetchBackend(aEndpoint, aMethod, aSendData, aCallback, aCallbackForward aCallback(e, 500, aCallbackForwards); } } - -function getParameterByName(aName) { - // from http://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript - name = aName.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); - var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), - results = regex.exec(location.search); - return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); -}