Fix: Protection pour utilisateur externe
This commit is contained in:
parent
82694e7d59
commit
9618978029
@ -156,59 +156,59 @@ if ($conf->ldap->enabled && $_GET["action"] == 'reactivate' && $candisableuser)
|
|||||||
// Action ajout user
|
// Action ajout user
|
||||||
if ($_POST["action"] == 'add' && $canadduser)
|
if ($_POST["action"] == 'add' && $canadduser)
|
||||||
{
|
{
|
||||||
$message="";
|
$message="";
|
||||||
if (! $_POST["nom"]) {
|
if (! $_POST["nom"]) {
|
||||||
$message='<div class="error">'.$langs->trans("NameNotDefined").'</div>';
|
$message='<div class="error">'.$langs->trans("NameNotDefined").'</div>';
|
||||||
$action="create"; // Go back to create page
|
$action="create"; // Go back to create page
|
||||||
}
|
}
|
||||||
if (! $_POST["login"]) {
|
if (! $_POST["login"]) {
|
||||||
$message='<div class="error">'.$langs->trans("LoginNotDefined").'</div>';
|
$message='<div class="error">'.$langs->trans("LoginNotDefined").'</div>';
|
||||||
$action="create"; // Go back to create page
|
$action="create"; // Go back to create page
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $message)
|
if (! $message)
|
||||||
{
|
{
|
||||||
$edituser = new User($db);
|
$edituser = new User($db);
|
||||||
|
|
||||||
$edituser->nom = trim($_POST["nom"]);
|
$edituser->nom = trim($_POST["nom"]);
|
||||||
$edituser->prenom = trim($_POST["prenom"]);
|
$edituser->prenom = trim($_POST["prenom"]);
|
||||||
$edituser->login = trim($_POST["login"]);
|
$edituser->login = trim($_POST["login"]);
|
||||||
$edituser->admin = trim($_POST["admin"]);
|
$edituser->admin = trim($_POST["admin"]);
|
||||||
$edituser->office_phone = trim($_POST["office_phone"]);
|
$edituser->office_phone = trim($_POST["office_phone"]);
|
||||||
$edituser->office_fax = trim($_POST["office_fax"]);
|
$edituser->office_fax = trim($_POST["office_fax"]);
|
||||||
$edituser->user_mobile = trim($_POST["user_mobile"]);
|
$edituser->user_mobile = trim($_POST["user_mobile"]);
|
||||||
$edituser->email = trim($_POST["email"]);
|
$edituser->email = trim($_POST["email"]);
|
||||||
$edituser->webcal_login = trim($_POST["webcal_login"]);
|
$edituser->webcal_login = trim($_POST["webcal_login"]);
|
||||||
$edituser->note = trim($_POST["note"]);
|
$edituser->note = trim($_POST["note"]);
|
||||||
$edituser->ldap_sid = trim($_POST["ldap_sid"]);
|
$edituser->ldap_sid = trim($_POST["ldap_sid"]);
|
||||||
|
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$id = $edituser->create();
|
$id = $edituser->create();
|
||||||
|
|
||||||
if ($id > 0)
|
if ($id > 0)
|
||||||
{
|
{
|
||||||
if (isset($_POST['password']) && trim($_POST['password']))
|
if (isset($_POST['password']) && trim($_POST['password']))
|
||||||
{
|
{
|
||||||
$edituser->password($user,trim($_POST['password']),$conf->password_encrypted);
|
$edituser->password($user,trim($_POST['password']),$conf->password_encrypted);
|
||||||
}
|
}
|
||||||
|
|
||||||
$db->commit();
|
$db->commit();
|
||||||
|
|
||||||
Header("Location: fiche.php?id=$id");
|
Header("Location: fiche.php?id=$id");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
|
|
||||||
//$message='<div class="error">'.$langs->trans("ErrorLoginAlreadyExists",$edituser->login).'</div>';
|
//$message='<div class="error">'.$langs->trans("ErrorLoginAlreadyExists",$edituser->login).'</div>';
|
||||||
$message='<div class="error">'.$edituser->error.$id.'</div>';
|
$message='<div class="error">'.$edituser->error.$id.'</div>';
|
||||||
|
|
||||||
$action="create"; // Go back to create page
|
$action="create"; // Go back to create page
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Action ajout groupe utilisateur
|
// Action ajout groupe utilisateur
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user