From 37193557dfc97b62d645fcc02b811e4dedd4e317 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 9 Dec 2020 08:36:52 +0100 Subject: [PATCH] FIX rename hook to be more explicit and $test = false --- htdocs/main.inc.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 2753a4e1fc8..1b6179fdc81 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -565,12 +565,15 @@ if (!defined('NOLOGIN')) // Hooks for security access $action = ''; $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++; + $parameters = array(); + $reshook = $hookmanager->executeHooks('beforeLoginAuthentication', $parameters, $user, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook < 0) { + $test = false; + $error++; + } // Verification security graphic code - if (GETPOST("username", "alpha", 2) && !empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA) && !isset($_SESSION['dol_bypass_antispam'])) + if ($test && GETPOST("username", "alpha", 2) && !empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA) && !isset($_SESSION['dol_bypass_antispam'])) { $sessionkey = 'dol_antispam_value'; $ok = (array_key_exists($sessionkey, $_SESSION) === true && (strtolower($_SESSION[$sessionkey]) == strtolower($_POST['code'])));