Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Logout: split in separate file. Regenerate session id on login / logout
--HG-- branch : 3.12
- Loading branch information
Showing
7 changed files
with
91 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?php | ||
|
||
/* ======================================================================== | ||
* Open eClass 3.12 | ||
* E-learning and Course Management System | ||
* ======================================================================== | ||
* Copyright 2003-2021 Greek Universities Network - GUnet | ||
* A full copyright notice can be read in "/info/copyright.txt". | ||
* For a full list of contributors, see "credits.txt". | ||
* | ||
* Open eClass is an open platform distributed in the hope that it will | ||
* be useful (without any warranty), under the terms of the GNU (General | ||
* Public License) as published by the Free Software Foundation. | ||
* The full license can be read in "/info/license/license_gpl.txt". | ||
* | ||
* Contact address: GUnet Asynchronous eLearning Group, | ||
* Network Operations Center, University of Athens, | ||
* Panepistimiopolis Ilissia, 15784, Athens, Greece | ||
* e-mail: info@openeclass.org | ||
* ======================================================================== */ | ||
|
||
/* | ||
* @file logout.php | ||
* | ||
* @abstract Redirect users to this file to log them out | ||
* | ||
*/ | ||
|
||
require_once '../../include/baseTheme.php'; | ||
require_once 'modules/auth/auth.inc.php'; | ||
require_once 'modules/auth/methods/hybridauth/config.php'; | ||
|
||
if ($uid) { | ||
$login_method = $session->getLoginMethod(); | ||
Database::get()->query("INSERT INTO loginout (loginout.id_user, | ||
loginout.ip, loginout.when, loginout.action) | ||
VALUES (?d, ?s, " . DBHelper::timeAfter() . ", 'LOGOUT')", $uid, Log::get_client_ip()); | ||
|
||
$config = get_hybridauth_config(); | ||
$hybridauth = new Hybridauth\Hybridauth($config); | ||
foreach ($hybridauth->getConnectedAdapters() as $adapter) { | ||
$adapter->disconnect(); | ||
} | ||
|
||
foreach (array_keys($_SESSION) as $key) { | ||
unset($_SESSION[$key]); | ||
} | ||
|
||
if (ini_get("session.use_cookies")) { | ||
$params = session_get_cookie_params(); | ||
setcookie(session_name(), '', time() - 42000, | ||
$params['path'], $params['domain'], | ||
$params['secure'], $params['httponly'] | ||
); | ||
} | ||
|
||
session_destroy(); | ||
|
||
$cas = ($login_method == 'cas')? get_auth_settings(7): false; | ||
if ($cas and isset($cas['cas_ssout']) and intval($cas['cas_ssout']) === 1) { | ||
phpCAS::client(SAML_VERSION_1_1, $cas['cas_host'], intval($cas['cas_port']), $cas['cas_context'], FALSE); | ||
phpCAS::logoutWithRedirectService($urlServer); | ||
} | ||
} | ||
|
||
redirect_to_home_page(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters