1
0
Fork 0
mirror of https://gitlab.easter-eggs.com/ee/ldapsaisie.git synced 2024-12-21 16:03:48 +01:00

Add LSauth :: afterLogout() trigger

This commit is contained in:
Benjamin Renard 2019-03-27 18:02:04 +01:00
parent d3f719a4e5
commit bf8eb1b8b9
3 changed files with 40 additions and 4 deletions

View file

@ -104,7 +104,23 @@ class LSauth {
* @retval void * @retval void
**/ **/
public static function logout() { public static function logout() {
if (!is_null(self :: $provider)) { if (!is_null(self :: $provider)) {
return self :: $provider -> logout();
}
LSerror :: addErrorCode('LSauth_06');
return;
}
/**
* After logout
*
* This method is run by LSsession after the local session was
* was successfully destroyed.
*
* @retval void
**/
public static function afterLogout() {
if (!is_null(self :: $provider)) {
return self :: $provider -> logout(); return self :: $provider -> logout();
} }
LSerror :: addErrorCode('LSauth_06'); LSerror :: addErrorCode('LSauth_06');

View file

@ -94,6 +94,18 @@ class LSauthMethod {
return true; return true;
} }
/**
* After logout
*
* This method is run by LSsession after the local session was
* was successfully destroyed.
*
* @retval void
**/
public static function afterLogout() {
return true;
}
/** /**
* Get LDAP credentials * Get LDAP credentials
* *

View file

@ -533,15 +533,23 @@ class LSsession {
} }
if (isset($_GET['LSsession_logout'])) { if (isset($_GET['LSsession_logout'])) {
// Trigger LSauth logout
LSauth :: logout(); LSauth :: logout();
session_destroy();
// Delete temporaries files
if (is_array($_SESSION['LSsession']['tmp_file'])) { if (is_array($_SESSION['LSsession']['tmp_file'])) {
self :: $tmp_file = $_SESSION['LSsession']['tmp_file']; self :: $tmp_file = $_SESSION['LSsession']['tmp_file'];
} }
self :: deleteTmpFile(); self :: deleteTmpFile();
unset($_SESSION['LSsession']);
// Destroy local session
unset($_SESSION['LSsession']);
session_destroy();
// Trigger LSauth after logout
LSauth :: afterLogout();
// Redirect user on home page
self :: redirect('index.php'); self :: redirect('index.php');
return; return;
} }