Merge pull request #21089 from atm-quentin/FIX_empty_password
FIX If the password does not match the rules, Dolibarr creates a user without a password
This commit is contained in:
commit
11ede876bb
@ -333,18 +333,26 @@ if (empty($reshook)) {
|
|||||||
|
|
||||||
$id = $object->create($user);
|
$id = $object->create($user);
|
||||||
if ($id > 0) {
|
if ($id > 0) {
|
||||||
|
$resPass = 0;
|
||||||
if (GETPOST('password', 'none')) {
|
if (GETPOST('password', 'none')) {
|
||||||
$object->setPassword($user, GETPOST('password', 'none'));
|
$resPass = $object->setPassword($user, GETPOST('password', 'none'));
|
||||||
}
|
}
|
||||||
if (!empty($conf->categorie->enabled)) {
|
if ($resPass < 0) {
|
||||||
// Categories association
|
$langs->load("errors");
|
||||||
$usercats = GETPOST('usercats', 'array');
|
$db->rollback();
|
||||||
$object->setCategories($usercats);
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
$action = "create"; // Go back to create page
|
||||||
$db->commit();
|
} else {
|
||||||
|
if (! empty($conf->categorie->enabled)) {
|
||||||
|
// Categories association
|
||||||
|
$usercats = GETPOST('usercats', 'array');
|
||||||
|
$object->setCategories($usercats);
|
||||||
|
}
|
||||||
|
$db->commit();
|
||||||
|
|
||||||
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id);
|
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id);
|
||||||
exit;
|
exit;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user