Can cumulate error message on different authentication modes

This commit is contained in:
Laurent Destailleur 2022-03-26 09:40:22 +01:00
parent 4d91e448ce
commit 396b532400
2 changed files with 4 additions and 1 deletions

View File

@ -69,6 +69,8 @@ function checkLoginPassEntity($usertotest, $passwordtotest, $entitytotest, $auth
// Validation of login/pass/entity with standard modules
if (empty($login)) {
unset($_SESSION["dol_loginmesg"]);
$test = true;
foreach ($authmode as $mode) {
if ($test && $mode && !$login) {
@ -111,7 +113,7 @@ function checkLoginPassEntity($usertotest, $passwordtotest, $entitytotest, $auth
// Load translation files required by the page
$langs->loadLangs(array('other', 'main', 'errors'));
$_SESSION["dol_loginmesg"] = $langs->transnoentitiesnoconv("ErrorFailedToLoadLoginFileForMode", $mode);
$_SESSION["dol_loginmesg"] = (isset($_SESSION["dol_loginmesg"]) ? $_SESSION["dol_loginmesg"].', ' : '').$langs->transnoentitiesnoconv("ErrorFailedToLoadLoginFileForMode", $mode);
}
}
}

View File

@ -736,6 +736,7 @@ if (!defined('NOLOGIN')) {
// Validation of login/pass/entity
// If ok, the variable login will be returned
// If error, we will put error message in session under the name dol_loginmesg
// Note authmode is an array for example: array('0'=>'dolibarr', '1'=>'google');
if ($test && $goontestloop && (GETPOST('actionlogin', 'aZ09') == 'login' || $dolibarr_main_authentication != 'dolibarr')) {
$login = checkLoginPassEntity($usertotest, $passwordtotest, $entitytotest, $authmode);
if ($login === '--bad-login-validity--') {