diff options
author | Andrew Dolgov <[email protected]> | 2021-02-08 19:11:31 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2021-02-08 19:11:31 +0300 |
commit | 51d2deeea911e84ea2e56b78544445de22f881b9 (patch) | |
tree | b4d769ada8fa871667771d0d9ec2c4a607f053bd /classes/userhelper.php | |
parent | fc2e0bf67bb279b960fb50060b6a7b59f0e5afb2 (diff) |
fix hierarchy of authentication modules, make everything extend Auth_Base and implement hook_auth_user() for pluginhost
Diffstat (limited to 'classes/userhelper.php')
-rw-r--r-- | classes/userhelper.php | 18 |
1 files changed, 9 insertions, 9 deletions
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) { |