diff --git a/sai/modules/saimod_sys_login/js/sai_sys_login_submit.js b/sai/modules/saimod_sys_login/js/sai_sys_login_submit.js index e0b508d..7edcf26 100644 --- a/sai/modules/saimod_sys_login/js/sai_sys_login_submit.js +++ b/sai/modules/saimod_sys_login/js/sai_sys_login_submit.js @@ -7,7 +7,13 @@ function init_saimod_sys_login() { system.account_login($('#bt_login_user').val(),$('#bt_login_password').val(),function(data){ if(data.status){ $('.help-block').html("Login successfull.
"); - location.reload(true); + var redirect = getParameterByName('redirect'); + if(redirect){ + location.href = location.protocol + '//' + location.host + location.pathname+'#!'+JSON.parse(redirect); + //system.load(); + } else { + location.reload(true); + } } else { $('.help-block').html("Login not successfull.
User & Password combination wrong."); } diff --git a/sai/modules/saistart_sys_sai/js/saistart_sys_sai.js b/sai/modules/saistart_sys_sai/js/saistart_sys_sai.js index b540562..b77ec4b 100644 --- a/sai/modules/saistart_sys_sai/js/saistart_sys_sai.js +++ b/sai/modules/saistart_sys_sai/js/saistart_sys_sai.js @@ -1,3 +1,13 @@ +function getParameterByName(name, url) { + if (!url) url = window.location.href; + name = name.replace(/[\[\]]/g, "\\$&"); + var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"), + results = regex.exec(url); + if (!results) return null; + if (!results[2]) return ''; + return decodeURIComponent(results[2].replace(/\+/g, " ")); +} + function init_saistart_sys_sai() { // Set all Panels the same height $(".inner-page").height(Math.max.apply(null, $(".inner-page").map(function(){return $(this).height();}).get())); @@ -9,7 +19,13 @@ function init_saistart_sys_sai() { system.account_login($('#bt_login_user').val(),$('#bt_login_password').val(),function(data){ if(data.status){ $('.help-block').html("Login successfull.
"); - location.reload(true); + var redirect = getParameterByName('redirect'); + if(redirect){ + location.href = location.protocol + '//' + location.host + location.pathname+'#!'+JSON.parse(redirect); + //system.load(); + } else { + location.reload(true); + } } else { $('.help-block').html("Login not successfull.
User & Password combination wrong."); } diff --git a/sai/sai/saigui.php b/sai/sai/saigui.php index e8bd84f..e382367 100644 --- a/sai/sai/saigui.php +++ b/sai/sai/saigui.php @@ -26,21 +26,20 @@ class saigui { public function html(){ \SYSTEM\SECURITY\security::isLoggedIn(); // refresh session //Direct JSON Input - $pg = json_decode(file_get_contents("php://input"), true); - if(!$pg){ - $pg = array_merge($_POST,$_GET);} + //$pg = json_decode(file_get_contents("php://input"), true); + //if(!$pg){ + $pg = array_merge($_POST,$_GET);//} if(isset($pg[self::SAI_MOD_POSTFIELD])){ $classname = \str_replace('.', '\\', $pg[self::SAI_MOD_POSTFIELD]); $pg[self::SAI_MOD_POSTFIELD] = \str_replace('.', '_', $pg[self::SAI_MOD_POSTFIELD]); - $mods = \SYSTEM\SAI\sai::getAllModules(); if( $classname && - \array_search($classname, $mods) !== false && + \array_search($classname, \SYSTEM\SAI\sai::getAllModules()) !== false && ( \call_user_func(array($classname, 'right_public')) || \call_user_func(array($classname, 'right_right')))){ return \SYSTEM\API\api::run('\SYSTEM\API\verify', $classname , $pg, 42, true, false); - } else { - return 'You are no longer logged in. Page reload in 5sec...';} + } else { + return '';} } else { return \SYSTEM\API\api::run('\SYSTEM\API\verify', '\SYSTEM\SAI\SaiModule', $pg, 42, false, true);} }