From 51d2deeea911e84ea2e56b78544445de22f881b9 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 8 Feb 2021 19:11:31 +0300 Subject: fix hierarchy of authentication modules, make everything extend Auth_Base and implement hook_auth_user() for pluginhost --- classes/userhelper.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'classes/userhelper.php') diff --git a/classes/userhelper.php b/classes/userhelper.php index b0a9dc598..4519f2803 100644 --- a/classes/userhelper.php +++ b/classes/userhelper.php @@ -7,15 +7,15 @@ class UserHelper { $user_id = false; $auth_module = false; - foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_AUTH_USER) as $plugin) { - - $user_id = (int) $plugin->authenticate($login, $password, $service); - - if ($user_id) { - $auth_module = strtolower(get_class($plugin)); - break; - } - } + PluginHost::getInstance()->chain_hooks_callback(PluginHost::HOOK_AUTH_USER, + function ($result, $plugin) use (&$user_id, &$auth_module) { + if ($result) { + $user_id = (int)$result; + $auth_module = strtolower(get_class($plugin)); + return true; + } + }, + $login, $password, $service); if ($user_id && !$check_only) { -- cgit v1.2.3