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

@ -111,6 +111,22 @@ class LSauth {
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();
}
LSerror :: addErrorCode('LSauth_06');
return;
}
/**
* Disable logout button in LSauth parameters
*

View file

@ -94,6 +94,18 @@ class LSauthMethod {
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
*

View file

@ -533,15 +533,23 @@ class LSsession {
}
if (isset($_GET['LSsession_logout'])) {
// Trigger LSauth logout
LSauth :: logout();
session_destroy();
// Delete temporaries files
if (is_array($_SESSION['LSsession']['tmp_file'])) {
self :: $tmp_file = $_SESSION['LSsession']['tmp_file'];
}
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');
return;
}