From 4973019630d51ad76b7c1a4141ec7a33053a7d21 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 24 Feb 2022 09:59:16 +0100 Subject: [PATCH] Fix #hunterb812ea22-0c02-46fe-b89f-04519dfb1ebd --- htdocs/user/card.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index f9b92d36d7233..de1ca3a5d92bd 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -402,12 +402,14 @@ $object->civility_code = GETPOST("civility_code", 'aZ09'); $object->lastname = GETPOST("lastname", 'alphanohtml'); $object->firstname = GETPOST("firstname", 'alphanohtml'); - $object->login = GETPOST("login", 'alphanohtml'); $object->gender = GETPOST("gender", 'aZ09'); $object->pass = GETPOST("password", 'none'); // We can keep 'none' for password fields $object->api_key = (GETPOST("api_key", 'alphanohtml')) ? GETPOST("api_key", 'alphanohtml') : $object->api_key; - if (!empty($user->admin)) { - $object->admin = GETPOST("admin", "int"); // admin flag can only be set/unset by an admin user. A test is also done later when forging sql request + if (!empty($user->admin)) { // admin flag can only be set/unset by an admin user. A test is also done later when forging sql request + $object->admin = GETPOST("admin", "int"); + } + if ($user->admin && !$object->ldap_sid) { // same test than on edit page + $object->login = GETPOST("login", 'alphanohtml'); } $object->address = GETPOST('address', 'alphanohtml'); $object->zip = GETPOST('zipcode', 'alphanohtml'); @@ -1856,7 +1858,7 @@ print '
'.$langs->trans("ReinitPassword").'
'; } elseif ($caneditpassword && $object->login && !$object->ldap_sid && ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) { - print '
'.$langs->trans("ReinitPassword").'
'; + print '
'.$langs->trans("ReinitPassword").'
'; } if ($object->statut == 0) { @@ -1864,7 +1866,7 @@ } elseif ($caneditpassword && $object->login && !$object->ldap_sid && ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) { if ($object->email) { - print '
'.$langs->trans("SendNewPassword").'
'; + print '
'.$langs->trans("SendNewPassword").'
'; } else { print '
'.$langs->trans("SendNewPassword").'
'; } @@ -1879,7 +1881,7 @@ // Disable user if ($user->id <> $id && $candisableuser && $object->statut == 1 && ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) { - print '
'.$langs->trans("DisableUser").'
'; + print '
'.$langs->trans("DisableUser").'
'; } else { if ($user->id == $id) { print '
'.$langs->trans("DisableUser").'
';