#342 redirect to old location on login if forced logout
This commit is contained in:
parent
145abe460f
commit
50daf11ef3
@ -7,7 +7,13 @@ function init_saimod_sys_login() {
|
|||||||
system.account_login($('#bt_login_user').val(),$('#bt_login_password').val(),function(data){
|
system.account_login($('#bt_login_user').val(),$('#bt_login_password').val(),function(data){
|
||||||
if(data.status){
|
if(data.status){
|
||||||
$('.help-block').html("Login successfull.</br>");
|
$('.help-block').html("Login successfull.</br>");
|
||||||
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 {
|
} else {
|
||||||
$('.help-block').html("Login not successfull.</br> User & Password combination wrong.");
|
$('.help-block').html("Login not successfull.</br> User & Password combination wrong.");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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() {
|
function init_saistart_sys_sai() {
|
||||||
// Set all Panels the same height
|
// Set all Panels the same height
|
||||||
$(".inner-page").height(Math.max.apply(null, $(".inner-page").map(function(){return $(this).height();}).get()));
|
$(".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){
|
system.account_login($('#bt_login_user').val(),$('#bt_login_password').val(),function(data){
|
||||||
if(data.status){
|
if(data.status){
|
||||||
$('.help-block').html("Login successfull.</br>");
|
$('.help-block').html("Login successfull.</br>");
|
||||||
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 {
|
} else {
|
||||||
$('.help-block').html("Login not successfull.</br> User & Password combination wrong.");
|
$('.help-block').html("Login not successfull.</br> User & Password combination wrong.");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,21 +26,20 @@ class saigui {
|
|||||||
public function html(){
|
public function html(){
|
||||||
\SYSTEM\SECURITY\security::isLoggedIn(); // refresh session
|
\SYSTEM\SECURITY\security::isLoggedIn(); // refresh session
|
||||||
//Direct JSON Input
|
//Direct JSON Input
|
||||||
$pg = json_decode(file_get_contents("php://input"), true);
|
//$pg = json_decode(file_get_contents("php://input"), true);
|
||||||
if(!$pg){
|
//if(!$pg){
|
||||||
$pg = array_merge($_POST,$_GET);}
|
$pg = array_merge($_POST,$_GET);//}
|
||||||
if(isset($pg[self::SAI_MOD_POSTFIELD])){
|
if(isset($pg[self::SAI_MOD_POSTFIELD])){
|
||||||
$classname = \str_replace('.', '\\', $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]);
|
$pg[self::SAI_MOD_POSTFIELD] = \str_replace('.', '_', $pg[self::SAI_MOD_POSTFIELD]);
|
||||||
|
|
||||||
$mods = \SYSTEM\SAI\sai::getAllModules();
|
|
||||||
if( $classname &&
|
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_public')) ||
|
||||||
\call_user_func(array($classname, 'right_right')))){
|
\call_user_func(array($classname, 'right_right')))){
|
||||||
return \SYSTEM\API\api::run('\SYSTEM\API\verify', $classname , $pg, 42, true, false);
|
return \SYSTEM\API\api::run('\SYSTEM\API\verify', $classname , $pg, 42, true, false);
|
||||||
} else {
|
} else {
|
||||||
return '<meta http-equiv="refresh" content="0; url=./sai.php">You are no longer logged in. Page reload in 5sec...';}
|
return '<script type="text/javascript"> window.location = "./sai.php?redirect="+JSON.stringify(system.cur_state());</script>';}
|
||||||
} else {
|
} else {
|
||||||
return \SYSTEM\API\api::run('\SYSTEM\API\verify', '\SYSTEM\SAI\SaiModule', $pg, 42, false, true);}
|
return \SYSTEM\API\api::run('\SYSTEM\API\verify', '\SYSTEM\SAI\SaiModule', $pg, 42, false, true);}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user