FIX if password doesnt match rule it created a user without password
This commit is contained in:
parent
c8ff7ff02a
commit
682da1fabe
@ -333,18 +333,26 @@ if (empty($reshook)) {
|
||||
|
||||
$id = $object->create($user);
|
||||
if ($id > 0) {
|
||||
$resPass = '';
|
||||
if (GETPOST('password', 'none')) {
|
||||
$object->setPassword($user, GETPOST('password', 'none'));
|
||||
$resPass = $object->setPassword($user, GETPOST('password', 'none'));
|
||||
}
|
||||
if (!empty($conf->categorie->enabled)) {
|
||||
// Categories association
|
||||
$usercats = GETPOST('usercats', 'array');
|
||||
$object->setCategories($usercats);
|
||||
}
|
||||
$db->commit();
|
||||
if($resPass < 0) {
|
||||
$langs->load("errors");
|
||||
$db->rollback();
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action = "create"; // Go back to create page
|
||||
} else {
|
||||
if(! empty($conf->categorie->enabled)) {
|
||||
// Categories association
|
||||
$usercats = GETPOST('usercats', 'array');
|
||||
$object->setCategories($usercats);
|
||||
}
|
||||
$db->commit();
|
||||
|
||||
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id);
|
||||
exit;
|
||||
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id);
|
||||
exit;
|
||||
}
|
||||
} else {
|
||||
$langs->load("errors");
|
||||
$db->rollback();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user