From 81f31399929361d19fb3260a43aa35f9b6cf5105 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 21 Feb 2024 22:13:23 +0300 Subject: add HOOK_VALIDATE_SESSION --- include/sessions.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'include') diff --git a/include/sessions.php b/include/sessions.php index 605ca9325..c863a4f2c 100644 --- a/include/sessions.php +++ b/include/sessions.php @@ -49,6 +49,21 @@ $_SESSION["login_error_msg"] = __("Session failed to validate (account is disabled)"); return false; } + + // default to true because there might not be any hooks and this is our last check + $hook_result = true; + + \PluginHost::getInstance()->chain_hooks_callback(\PluginHost::HOOK_VALIDATE_SESSION, + function ($result) use (&$hook_result) { + $hook_result = $result; + + if (!$result) { + return true; + } + }); + + return $hook_result; + } else { $_SESSION["login_error_msg"] = __("Session failed to validate (user not found)"); return false; -- cgit v1.2.3