Commit e694d206 authored by nkoth's avatar nkoth

[MOD] In new autologin feature, send base_url instead of logout url as it can...

[MOD] In new autologin feature, send base_url instead of logout url as it can then be used for more generic things to point back to originating Tiki
parent 071ddae5
......@@ -172,8 +172,7 @@ function get_remotetikiurl($autologin_remotetiki, $redirect_page) {
$remotetikiurl = $autologin_remotetiki . '/tiki-autologin.php';
$client = TikiLib::lib('tiki')->get_http_client( $remotetikiurl );
$groups = TikiLib::lib('user')->get_user_groups($user);
$remotelogout_url = $base_url . 'tiki-logout.php';
$base = array( 'uname' => $user, 'email' => $email, 'realName' => $realName, 'page' => $redirect_page, 'remotelogout_url' => $remotelogout_url, 'groups' => $groups );
$base = array( 'uname' => $user, 'email' => $email, 'realName' => $realName, 'page' => $redirect_page, 'base_url' => $base_url, 'groups' => $groups );
try {
$client->setParameterPost( $base );
$response = $client->request( 'POST' );
......
......@@ -45,10 +45,11 @@ if (!empty($_REQUEST['page'])) {
$page = '';
}
if (!empty($_REQUEST['remotelogout_url'])) {
$remotelogout_url = $_REQUEST['remotelogout_url'];
if (!empty($_REQUEST['base_url'])) {
$autologin_base_url = $_REQUEST['base_url'];
} else {
$remotelogout_url = '';
$access->display_error('', tra('Base URL not received from remote system'), "500");
die;
}
if ($user == $prefs['login_autologin_user']) {
......@@ -94,7 +95,7 @@ if ($user == $prefs['login_autologin_user']) {
$tokenlib = AuthTokens::build( $prefs );
$params['uname'] = $uname;
$params['page'] = $page;
$params['remotelogout_url'] = $remotelogout_url;
$params['base_url'] = $autologin_base_url;
$url = $base_url . 'tiki-autologin.php' . '?' . http_build_query( $params, '', '&' );
$url = $tokenlib->includeToken( $url, array($prefs['login_autologin_group']), '', 30, 1);
echo $url;
......@@ -105,8 +106,8 @@ if ($user == $prefs['login_autologin_user']) {
die;
}
if ($user || TikiLib::lib('user')->autologin_user($uname)) {
if (!empty($remotelogout_url)) {
$_SESSION['autologin_remotelogout_url'] = $remotelogout_url;
if (!empty($autologin_base_url)) {
$_SESSION['autologin_base_url'] = $autologin_base_url;
}
if (!empty($page)) {
$sefurl = TikiLib::lib('wiki')->sefurl($page);
......
......@@ -28,8 +28,8 @@ if (!empty($_REQUEST['page'])) {
$out_page = '';
}
if ($prefs['login_autologin'] == 'y' && $prefs['login_autologin_logoutremote'] == 'y' && !empty($_SESSION['autologin_remotelogout_url'])) {
$out_page = $_SESSION['autologin_remotelogout_url'];
if ($prefs['login_autologin'] == 'y' && $prefs['login_autologin_logoutremote'] == 'y' && !empty($_SESSION['autologin_base_url'])) {
$out_page = $_SESSION['autologin_base_url'] . 'tiki-logout.php';
}
$userlib->user_logout($user, false, $out_page);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment