Update user.class.php

This commit is contained in:
Laurent Destailleur 2022-01-25 16:03:30 +01:00 committed by GitHub
parent 6677eccf45
commit 05ff99f2e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1789,7 +1789,7 @@ class User extends CommonObject
$this->fk_warehouse = (int) $this->fk_warehouse;
// Check parameters
$badCharUnauthorizedIntoLoginName = getDolGlobalString('MAIN_LOGIN_BADCHARUNAUTHORIZED', '/[,@<>"\']/');
$badCharUnauthorizedIntoLoginName = getDolGlobalString('MAIN_LOGIN_BADCHARUNAUTHORIZED', ',@<>"\'');
if (!empty($conf->global->USER_MAIL_REQUIRED) && !isValidEMail($this->email)) {
$langs->load("errors");
@ -1800,7 +1800,7 @@ class User extends CommonObject
$langs->load("errors");
$this->error = $langs->trans("ErrorFieldRequired", 'Login');
return -1;
} elseif (preg_match($badCharUnauthorizedIntoLoginName, $this->login)) {
} elseif (preg_match('/['.preg_quote($badCharUnauthorizedIntoLoginName, '/').']/', $this->login)) {
$langs->load("errors");
$this->error = $langs->trans("ErrorBadCharIntoLoginName");
return -1;