From 724d03c75487a3645920aade27ac985482cbe179 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 8 Dec 2020 19:26:24 +0100 Subject: [PATCH 1/2] NEW add hook "loginCheckSecurityAccess" (eg for external captcha) --- htdocs/main.inc.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 81f560d662c..d0c3b31672b 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -562,6 +562,13 @@ if (!defined('NOLOGIN')) } } + // Hooks for security access + $action = ''; + $hookmanager->initHooks(array('loginsecurity')); + $parameters = array('dol_authmode'=>$dol_authmode); + $reshook = $hookmanager->executeHooks('loginCheckSecurityAccess', $parameters, $user, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook < 0) $error++; + // Verification security graphic code if (GETPOST("username", "alpha", 2) && !empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA) && !isset($_SESSION['dol_bypass_antispam'])) { From 3836e5685affb361f420021373e1d6eefaf6a381 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 8 Dec 2020 19:30:40 +0100 Subject: [PATCH 2/2] FIX same context of others --- htdocs/main.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index d0c3b31672b..dd14455278f 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -564,7 +564,7 @@ if (!defined('NOLOGIN')) // Hooks for security access $action = ''; - $hookmanager->initHooks(array('loginsecurity')); + $hookmanager->initHooks(array('login')); $parameters = array('dol_authmode'=>$dol_authmode); $reshook = $hookmanager->executeHooks('loginCheckSecurityAccess', $parameters, $user, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) $error++;