Auth: add logout hook

This commit is contained in:
Benjamin Renard 2023-02-25 15:49:47 +01:00
parent 9999f46c78
commit 1d7387fb18

View file

@ -281,6 +281,7 @@ class Auth {
* @return void * @return void
*/ */
public static function logout() { public static function logout() {
$user = self :: $user;
$method = ( $method = (
self :: $logged_method? self :: $logged_method?
self :: $logged_method: self :: $logged_method:
@ -292,6 +293,7 @@ class Auth {
unset($_SESSION['user']); unset($_SESSION['user']);
if (isset($_SESSION['auth_method'])) if (isset($_SESSION['auth_method']))
unset($_SESSION['auth_method']); unset($_SESSION['auth_method']);
Hook :: trigger('logout', array('method' => $method, 'user' => $user));
if ($method) if ($method)
call_user_func(array(self :: $methods[$method], 'logout')); call_user_func(array(self :: $methods[$method], 'logout'));
} }