Files
PHP-LDAP/views/edit_user.php

42 lines
1.2 KiB
PHP

<?php
session_start();
if (!isset($_SESSION["login"]) || !$_SESSION["is_admin"]) {
header('Location: auth.php');
exit;
}
require_once __DIR__ . '/../models/LDAPAuth.php';
$ldapAuth = new LDAPAuth();
// Récupérer les détails de l'utilisateur à modifier
$user_dn = urldecode($_GET['dn']);
$user_details = $ldapAuth->getUserDetailsByDn($user_dn);
?>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<title>Modifier un utilisateur</title>
</head>
<body>
<h1>Modifier l'utilisateur</h1>
<form action="../controllers/edit_user.php" method="post">
<input type="hidden" name="dn" value="<?= htmlspecialchars($user_dn) ?>">
<input type="text" id="firstname" name="firstname" value="<?= htmlspecialchars($user_details['givenName'] ?? '') ?>">
<input type="text" id="lastname" name="lastname" value="<?= htmlspecialchars($user_details['sn'] ?? '') ?>">
<input type="email" id="email" name="email" value="<?= htmlspecialchars($user_details['mail'] ?? '') ?>">
<label for="new_password">Nouveau mot de passe :</label>
<input type="password" id="new_password" name="new_password">
<button type="submit">Modifier l'utilisateur</button>
</form>
</body>
</html>