// user scripts (login / logout / check // login function LogIn() { ShowOverlay(); $("#DV_Alert_Login").delay(100).fadeOut(); var data = { action: "login", Benutzername: $("#FM_Login_username").val(), Passwort: $("#FM_Login_password").val() }; $.post("../ajax/json.aspx", data, function (jsonObj) { jsonObj = CreateJSONObject(jsonObj); if (jsonObj.LoginStatus) { $("#dialog_login").dialog({ hide: 'slide', show: 'slide', close: function (event, ui) { } }); $("#dialog_login").dialog("close"); // create cookie MaincreateCookie("webi_Token", "Profilcode=" + jsonObj.Profilcode + "&Token=" + jsonObj.Token, 30); // and now redirect to index.aspx because cookie will otherwies missing in checklogin server side document.location.href = "index.aspx"; } else { // show error HideOverlay(); $("#DV_Alert_Login").delay(100).fadeIn(); $("#DV_Alert_Login_Message").html(jsonObj.Fehlermeldung); } }); return false; } // check login (in intervall) function CheckLogin() { $.get("../ajax/json.aspx?action=checkLogin&startup=false", function (jsonObj) { jsonObj = CreateJSONObject(jsonObj); if (!jsonObj.LoginStatus) { //alert("login failed" + jsonObj.LoginFehler); ClearIntervalls(false); _LogOut(); } else { // always clear startup login checker window.clearInterval(IV_CheckLoginStartup); // always check access SetAccess(jsonObj); } }); } // check login (in startup intervall) function CheckLoginStartup() { //alert("check CheckLoginStartup"); $.get("../ajax/json.aspx?action=checkLogin&startup=true", function (jsonObj) { jsonObj = CreateJSONObject(jsonObj); if (jsonObj.LoginStatus) { $("#dialog_login").dialog({ hide: 'slide', show: 'slide', close: function (event, ui) { } }); $("#dialog_login").dialog("close"); ShowOverlay(); // always clear startup login checker window.clearInterval(IV_CheckLoginStartup); // start app StartApplication(jsonObj); } }); } // logout function LogOut() { ShowOverlay(); $("#dialog_logout").dialog("close"); $.get("../ajax/rest.aspx?action=logOut", function (restObj) { var cookies = document.cookie.split(";"); for (var i = 0; i < cookies.length; i++) { del_cookie(cookies[i].split("=")[0]); } _LogOut(); }); return false; } function _LogOut() { $("#wrapper").delay(100).fadeOut(); document.location.href = "index.aspx"; // restart auto startuper 60 seconds window.clearInterval(IV_CheckLoginStartup); IV_CheckLoginStartup = window.setInterval("CheckLoginStartup()", 60000); } function del_cookie(name) { document.cookie = name + '=; expires=Thu, 01-Jan-70 00:00:01 GMT;'; }