From 2678472e49568fcef090e8f5b155aa84db2675e0 Mon Sep 17 00:00:00 2001 From: Molkobain Date: Fri, 10 Jul 2026 10:03:39 +0200 Subject: [PATCH] =?UTF-8?q?N=C2=B09625=20-=20Add=20Session::UnsetAll()=20m?= =?UTF-8?q?ethod=20to=20ensure=20that=20even=20the=20"welcome"=20session?= =?UTF-8?q?=20value=20is=20correctly=20resetted?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/loginwebpage.class.inc.php | 11 +---------- sources/Service/Session/Session.php | 13 +++++++++++++ 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/application/loginwebpage.class.inc.php b/application/loginwebpage.class.inc.php index 2355ff847..515ed00f1 100644 --- a/application/loginwebpage.class.inc.php +++ b/application/loginwebpage.class.inc.php @@ -369,16 +369,7 @@ class LoginWebPage extends NiceWebPage public static function ResetSession() { // Unset all of the session variables. - Session::Unset('auth_user'); - Session::Unset('login_state'); - Session::Unset('can_logoff'); - Session::Unset('archive_mode'); - Session::Unset('impersonate_user'); - Session::Unset('PluginProperties'); - Session::Unset('UrlMakerClass'); - Session::Unset('itop_env'); - Session::Unset('obj_messages'); - Session::Unset('profile_list'); + Session::UnsetAll(); UserRights::_ResetSessionCache(); // If it's desired to kill the session, also delete the session cookie. // Note: This will destroy the session, and not just the session data! diff --git a/sources/Service/Session/Session.php b/sources/Service/Session/Session.php index 6eb96ab03..2fdb494ee 100644 --- a/sources/Service/Session/Session.php +++ b/sources/Service/Session/Session.php @@ -131,6 +131,19 @@ class Session } } + /** + * Unset all session variables, no matter if they were set by iTop or not + * + * @return void + * @since 3.3.0 N°9625 + */ + public static function UnsetAll(): void + { + foreach (self::ListVariables() as $sKey) { + self::Unset($sKey); + } + } + /** * @param string|array $key key to access to the session variable. To access to $_SESSION['a']['b'] $key must be ['a', 'b'] * @param $default