From 4cfe8e3144f842fcfa85238119816261e79bbf4c Mon Sep 17 00:00:00 2001 From: atisne Date: Mon, 23 Dec 2024 12:31:26 +0100 Subject: [PATCH 1/2] Make the plugin compliant with authsplit one Events must also be registered when oauth plugin is used as primary plugin by authsplit plugin. --- action/login.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/action/login.php b/action/login.php index 8bb16f8..5a846b8 100644 --- a/action/login.php +++ b/action/login.php @@ -40,7 +40,8 @@ public function __construct() public function register(EventHandler $controller) { global $conf; - if ($conf['authtype'] != 'oauth') return; + if (! (($conf['authtype'] == 'oauth') + or ($conf['authtype'] == 'authsplit' and $conf['plugin']['authsplit']['primary_authplugin'] == 'oauth'))) return; $conf['profileconfirm'] = false; // password confirmation doesn't work with oauth only users From cc8de9a995159c45601f706880b5d77fa4ee8c36 Mon Sep 17 00:00:00 2001 From: atisne Date: Mon, 23 Dec 2024 12:34:28 +0100 Subject: [PATCH 2/2] Make the plugin compliant with authsplit one OAuth options may be read through authsplit plugin. --- OAuthManager.php | 4 ++-- auth.php | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/OAuthManager.php b/OAuthManager.php index b7f0f94..e0912e7 100644 --- a/OAuthManager.php +++ b/OAuthManager.php @@ -253,7 +253,7 @@ protected function processUserData($userdata, $servicename) $localUserInfo['grps'], $userdata['grps'] ?? [], array_keys($helper->listServices(false)), - $auth->getConf('overwrite-groups') + $auth->getOption('overwrite-groups') ); // update user if changed @@ -262,7 +262,7 @@ protected function processUserData($userdata, $servicename) if ($localUserInfo != $userdata && !isset($localUserInfo['protected'])) { $auth->modifyUser($localUser, $userdata); } - } elseif (actionOK('register') || $auth->getConf('register-on-auth')) { + } elseif (actionOK('register') || $auth->getOption('register-on-auth')) { if (!$auth->registerOAuthUser($userdata, $servicename)) { throw new Exception('generic create error'); } diff --git a/auth.php b/auth.php index 96a4d85..31a7545 100644 --- a/auth.php +++ b/auth.php @@ -195,6 +195,18 @@ public function getLang($id) return $parent->getLang($id); } + /** + * Get an option + * + * @param string $option The name of the wanted option + * + * @return string The option value + */ + public function getOption($option) + { + return $this->getConf($option); + } + /** * Farmer plugin support *