Fix: Protection to avoid renaming a user with a login that already
exists.
This commit is contained in:
parent
049bf1ee00
commit
14dede1a74
@ -307,9 +307,27 @@ if ($action == 'update' && ! $_POST["cancel"])
|
|||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$db->begin();
|
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
|
|
||||||
|
// Test if new login
|
||||||
|
if (GETPOST("login") && GETPOST("login") != $object->login)
|
||||||
|
{
|
||||||
|
dol_syslog("New login ".$object->login." is requested. We test it does not exists.");
|
||||||
|
$tmpuser=new User($db);
|
||||||
|
$result=$tmpuser->fetch(0, GETPOST("login"));
|
||||||
|
if ($result > 0)
|
||||||
|
{
|
||||||
|
$message='<div class="error">'.$langs->trans("ErrorLoginAlreadyExists").'</div>';
|
||||||
|
$action="edit"; // Go back to create page
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
$db->begin();
|
||||||
|
|
||||||
$object->oldcopy=dol_clone($object);
|
$object->oldcopy=dol_clone($object);
|
||||||
|
|
||||||
$object->lastname = GETPOST("nom");
|
$object->lastname = GETPOST("nom");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user