1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2025-12-13 03:15:56 +00:00

fix hierarchy of authentication modules, make everything extend Auth_Base and implement hook_auth_user() for pluginhost

This commit is contained in:
Andrew Dolgov
2021-02-08 19:11:31 +03:00
parent fc2e0bf67b
commit 51d2deeea9
5 changed files with 25 additions and 32 deletions

View File

@@ -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) {