From fcc7e22fdb2d56bf8ebd79f2efbda3c8bf3ff78c Mon Sep 17 00:00:00 2001 From: Morph01 Date: Tue, 4 Feb 2025 17:30:04 -0800 Subject: [PATCH] feat: add CSS styling --- assets/css/style.css | 269 ++++++++++++++++++++++++++++++++++++++++++ models/LDAPAuth.php | 2 +- test.php | 31 ----- views/auth.php | 1 + views/create_user.php | 1 + views/delete_user.php | 1 + views/edit_user.php | 8 +- views/list_users.php | 66 ++++++----- views/menu.php | 140 ++++++++++++---------- 9 files changed, 395 insertions(+), 124 deletions(-) create mode 100644 assets/css/style.css delete mode 100644 test.php diff --git a/assets/css/style.css b/assets/css/style.css new file mode 100644 index 0000000..286b13f --- /dev/null +++ b/assets/css/style.css @@ -0,0 +1,269 @@ +/* Reset et styles de base */ +* { + margin: 0; + box-sizing: border-box; +} + +/* Menu Lists specific padding */ +.menu-content ul { + padding-left: 40px; +} + +.menu-content ul ul { + padding-left: 20px; +} + +/* Content containers */ +.menu-content, +.profile-content { + margin: 20px; + padding: 15px; + background: #fff; + border-radius: 5px; + box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); +} + +.logout-form { + position: absolute; + top: 20px; + right: 20px; + background: transparent; + border: none; + padding: 0; + margin: 0; +} + +.logout-button { + background-color: #3498db; + color: white; + padding: 10px 20px; + border: none; + border-radius: 4px; + cursor: pointer; +} + +.logout-button:hover { + background-color: #2980b9; +} + +.action-buttons { + text-align: center; + padding: 8px 0; +} + +.btn { + display: inline-block; + padding: 6px 12px; + margin: 0 15px; + border-radius: 4px; + text-decoration: none; + color: white; + min-width: 80px; +} + +.btn-edit { + background-color: #3498db; +} + +.btn-edit:hover { + background-color: #2980b9; + text-decoration: none; +} + +.btn-delete { + background-color: #e74c3c; +} + +.btn-delete:hover { + background-color: #c0392b; + text-decoration: none; +} + +body { + font-family: Arial, sans-serif; + line-height: 1.6; + padding: 20px; + background-color: #f4f4f4; + color: #333; +} + +/* En-têtes */ +h1, +h2, +h3 { + color: #2c3e50; + margin-bottom: 15px; +} + +h1 { + font-size: 2em; +} + +h2 { + font-size: 2em; + margin: 20px +} + +h3 { + font-size: 1.2em; +} + +/* Tableaux */ +table { + width: 100%; + border-collapse: collapse; + margin: 15px 0; + background: #fff; + box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); +} + +th, +td { + padding: 12px; + text-align: left; + border: 1px solid #ddd; +} + +th { + background-color: #3498db; + color: white; + font-weight: bold; +} + +tr:nth-child(even) { + background-color: #f9f9f9; +} + +/* Formulaires */ +form { + background: #fff; + padding: 20px; + border-radius: 5px; + box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); + max-width: 500px; + margin: 20px auto; +} + +label { + display: block; + margin: 10px 0 5px; + font-weight: bold; +} + +input[type="text"], +input[type="password"], +input[type="email"], +select { + width: 100%; + padding: 8px; + margin-bottom: 10px; + border: 1px solid #ddd; + border-radius: 4px; +} + +input[type="submit"], +button { + background-color: #3498db; + color: white; + padding: 10px 20px; + border: none; + border-radius: 4px; + cursor: pointer; + margin-top: 10px; +} + +input[type="submit"]:hover, +button:hover { + background-color: #2980b9; +} + +/* Liens */ +a { + color: #3498db; + text-decoration: none; +} + +a:hover { + text-decoration: underline; +} + +/* Menu Lists */ +.menu ul { + list-style: none; + padding-left: 20px; + margin: 15px 0; +} + +.menu li { + margin-bottom: 15px; + padding: 10px; + background: rgba(255, 255, 255, 0.8); + border-radius: 4px; +} + +.menu ul ul { + margin-left: 20px; + border-left: 3px solid #3498db; + padding-left: 15px; +} + +.menu ul ul li { + margin: 8px 0; + padding: 5px 10px; + background: rgba(255, 255, 255, 0.5); +} + +.ou-list { + margin-top: 20px; +} + +.ou-section { + padding: 15px; + background: #fff; + border-radius: 5px; + box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); + margin-bottom: 15px; +} + +.ou-section h4 { + color: #2c3e50; + margin-bottom: 10px; +} + +.ou-section a { + display: inline-block; + margin: 5px 10px; + padding: 5px 0; +} + +/* Messages */ +.error { + color: #e74c3c; + padding: 10px; + background: #fde; + border-left: 4px solid #e74c3c; + margin: 10px 0; +} + +.success { + color: #27ae60; + padding: 10px; + background: #dfd; + border-left: 4px solid #27ae60; + margin: 10px 0; +} + +/* Bouton de déconnexion */ +.logout-form { + position: absolute; + top: 20px; + right: 20px; +} + +.logout-button { + background-color: #e74c3c; +} + +.logout-button:hover { + background-color: #c0392b; +} \ No newline at end of file diff --git a/models/LDAPAuth.php b/models/LDAPAuth.php index 5d07158..b8ff268 100644 --- a/models/LDAPAuth.php +++ b/models/LDAPAuth.php @@ -366,7 +366,7 @@ class LDAPAuth $this->bindServiceAccount(); $filter = "(objectClass=user)"; - $attributes = ["givenName", "sn", "mail", "sAMAccountName"]; + $attributes = ["Name", "sn", "givenName","mail", "sAMAccountName"]; $result = ldap_read($this->ad, $dn, $filter, $attributes); $entries = ldap_get_entries($this->ad, $result); diff --git a/test.php b/test.php deleted file mode 100644 index 58a7e85..0000000 --- a/test.php +++ /dev/null @@ -1,31 +0,0 @@ -authenticate("a.gathor", "Test@123"); - -if ($result['success']) { - echo "✅ Authentification réussie pour " . $result['dn']; -} else { - echo "❌ " . $result['message']; -} - -$ldap->close(); diff --git a/views/auth.php b/views/auth.php index 9679532..ae84697 100644 --- a/views/auth.php +++ b/views/auth.php @@ -5,6 +5,7 @@ Authentification + diff --git a/views/create_user.php b/views/create_user.php index 7967083..81ecbe7 100644 --- a/views/create_user.php +++ b/views/create_user.php @@ -12,6 +12,7 @@ if (!isset($_SESSION["login"]) || !$_SESSION["is_admin"]) { Créer un utilisateur + diff --git a/views/delete_user.php b/views/delete_user.php index f283f34..f601f3a 100644 --- a/views/delete_user.php +++ b/views/delete_user.php @@ -14,6 +14,7 @@ $user_dn = urldecode($_GET['dn']); Supprimer un utilisateur + diff --git a/views/edit_user.php b/views/edit_user.php index c57f8e5..245f2ef 100644 --- a/views/edit_user.php +++ b/views/edit_user.php @@ -19,6 +19,7 @@ $user_details = $ldapAuth->getUserDetailsByDn($user_dn); Modifier un utilisateur + @@ -26,10 +27,13 @@ $user_details = $ldapAuth->getUserDetailsByDn($user_dn);
- - + + + + + diff --git a/views/list_users.php b/views/list_users.php index 9bd7cb2..3ef5764 100644 --- a/views/list_users.php +++ b/views/list_users.php @@ -1,25 +1,35 @@ - + -if (!isset($_SESSION["login"]) || !$_SESSION["is_admin"]) { - header('Location: ../auth.php'); - exit; -} + + + Liste des utilisateurs + + -// Récupérer les utilisateurs selon l'OU -$users = listUsers(); + + Gestion des utilisateurs"; + if (!isset($_SESSION["login"]) || !$_SESSION["is_admin"]) { + header('Location: ../auth.php'); + exit; + } -if (isset($_GET['ou'])) { - echo "

OU : " . htmlspecialchars(urldecode($_GET['ou'])) . "

"; -} + // Récupérer les utilisateurs selon l'OU + $users = listUsers(); -if (!empty($users)) { - echo ""; - echo " + // Afficher le tableau des utilisateurs + echo "

Gestion des utilisateurs

"; + + if (isset($_GET['ou'])) { + echo "

OU : " . htmlspecialchars(urldecode($_GET['ou'])) . "

"; + } + + if (!empty($users)) { + echo "
"; + echo " @@ -27,23 +37,23 @@ if (!empty($users)) { "; - foreach ($users as $entry) { - if (!is_array($entry)) continue; + foreach ($users as $entry) { + if (!is_array($entry)) continue; - echo " + echo " - "; + } + echo "
Nom Prénom EmailActions
" . ($entry['sn'][0] ?? '') . " " . ($entry['givenname'][0] ?? '') . " " . ($entry['mail'][0] ?? '') . " " . ($entry['distinguishedname'][0] ?? '') . " - Modifier - Supprimer + + Modifier + Supprimer
"; + } else { + echo "

Aucun utilisateur trouvé dans cette OU.

"; } - echo ""; -} else { - echo "

Aucun utilisateur trouvé dans cette OU.

"; -} -echo "

Retour au menu

"; + echo "

Retour au menu

"; diff --git a/views/menu.php b/views/menu.php index 6f11628..7282f1e 100644 --- a/views/menu.php +++ b/views/menu.php @@ -1,82 +1,98 @@ - + -if (!isset($_SESSION["login"]) || $_SESSION["login"] !== true) { - header('Location: ../auth.php'); - exit; -} + + + Menu + + -require_once __DIR__ . '/../controllers/controllerAdmin.php'; + -echo "Bienvenue " . $_SESSION["sAMAccountName"] . "!"; + Menu"; -echo "