diff --git a/main/auth/cas/authcas.php b/main/auth/cas/authcas.php index d7fbb5637d..137612bc7d 100644 --- a/main/auth/cas/authcas.php +++ b/main/auth/cas/authcas.php @@ -172,14 +172,14 @@ function cas_logout($uinfo=null, $location=null) { global $cas_auth_ver, $cas_auth_server, $cas_auth_port, $cas_auth_uri; global $PHPCAS_CLIENT; - if (!is_object($PHPCAS_CLIENT)) - { - phpCAS::client($cas_auth_ver,$cas_auth_server,$cas_auth_port,$cas_auth_uri); + if (!is_object($PHPCAS_CLIENT)) { + phpCAS::client($cas_auth_ver, $cas_auth_server, $cas_auth_port, $cas_auth_uri); phpCAS::setNoCasServerValidation(); } - if (!isset($location)) + if (!isset($location)) { $location = api_get_path(WEB_PATH); + } phpCAS::logoutWithRedirectService($location); } diff --git a/main/inc/local.inc.php b/main/inc/local.inc.php index 4efe3d8687..63a3e43ba4 100644 --- a/main/inc/local.inc.php +++ b/main/inc/local.inc.php @@ -343,10 +343,11 @@ if (!empty($_SESSION['_user']['user_id']) && !($login || $logout)) { // Fix cas redirection loop // https://support.chamilo.org/issues/6124 $location = api_get_path(WEB_PATH).'index.php?loginFailed=1&error=access_url_inactive'; - if ($cas_login) + if ($cas_login) { cas_logout(null, $location); - else + } else { header('Location: '.$location); + } exit; } } else { //Only admins of the "main" (first) Chamilo portal can login wherever they want