X-Git-Url: https://git-public.kairo.at/?p=lantea.git;a=blobdiff_plain;f=js%2Floginwindow.js;h=94cd6c2ca63e44cd38eafe13329eb80b308ccb5c;hp=ebbdde4f7f840a088e74c9fbd0f0def0faa12b2b;hb=c53a1969fd519687ca4d581077c8dc3792169bb8;hpb=6ba597ed42a0ebbb340112ab1b9a8316dc8f26cd diff --git a/js/loginwindow.js b/js/loginwindow.js index ebbdde4..94cd6c2 100644 --- a/js/loginwindow.js +++ b/js/loginwindow.js @@ -1,19 +1,22 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ -console.log("JS-load"); window.onload = function() { // Complete the login process by calling the main window. - console.log("onload"); if (window.opener) { - console.log("opener"); window.opener.finishLogin(getParameterByName("code"), getParameterByName("state")); - console.log("finished"); window.close(); } else { - console.log("no-opener"); document.getElementById("logininfo").textContent = "You have called this document outside of the login flow, which is not supported."; } } + +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, " ")); +}