diff --git a/SPECS.md b/SPECS.md new file mode 100644 index 0000000..322ffb0 --- /dev/null +++ b/SPECS.md @@ -0,0 +1,37 @@ +- l'ordre des TFE sur la page d'accueil ; est-ce que ce serait possible de les faire dérouler par année – avec les plus récents tout en haut –, mais en rendant l'ordre de chaque année aléatoire + +- On a les pdf et notes d'intention des dernières années, est-ce que vous voulez déjà y avoir accès ? Est-ce qu'il y a une nomenclature particulière qui vous fait plaisir ? + +## admin + +- Il a été décidé de – pour l’instant – ne pas rendre les TFE visibles vers l’extérieur. + +- option d’ouverture “interne” – qui sera à priori le défaut appliqué sur une majorité des TFE – + +pas disponnible: + +- le pdf ainsi que la note d’intention ne soient que disponibles quand les personnes se trouvent physiquement à l’erg (via adresse IP) ou via login (à voir ce qui est le plus simple à intégrer techniquement). + +## le formulaire de dépôt + +- On demandera aux étudiant·es de préparer une image au bon format pour le dépôt du TFE. Est-ce que vous pouvez nous donner la taille qu'il faudrait ? + +- la page de formulaire:celle que les étudiant·es doivent remplir lors du dépôt du TFE, ajouter: + - l'explication; + - le contexte des différents choix soient visibles. + +- Quand un·é étudiant·e dépose son TFE, il ne doit pas être publié directement. Il doit arriver dans la base de donnée, et quelqu'un viendrait juste clicker sur “publier” dans le backoffice une fois la défense orale terminée (et en fonction du retour du jury). + +- l’option “libre” ne doit donc pas encore exister cette année. + - créer un système de toggle pour quelles sont les options actives dans le formulaire + - Il n’y a pour l’instant que l’option “interdit” et “interne”. L’option “libre” ne sera activée que à partir de l’année académique prochaine. + +- la case “contact” soit accompagnée d’une case à cocher/décocher ; « Je veux que mon contact soit accessible à toustes depuis la plateforme xamxam ». En fonction de cette réponse, le contact apparaîtrait ou non sur la page du TFE. + +## la base de donnée + +- rajouter une catégorie “objet” pour que, dans un futur éventuel, on puisse différencier les TFE des FRART et des thèses. Pour l’instant c’est juste un tag qui doit apparaître en back-office. + +- quelle(s) fonte(s) est-ce que vous utilisez sur le site ? +- est-ce que vous pouvez m’envoyez un export de la maquette du site ? (en .jpg c’est ok, c’est juste pour rafraîchir nos mémoires afin qu'on puisse produire les textes en adéquation avec ce qui existe) +- les questions du dernier mail :) diff --git a/TODO.md b/TODO.md index a4c0eac..05b9175 100644 --- a/TODO.md +++ b/TODO.md @@ -1,6 +1,12 @@ # TODO ## Done +- [x] Create Paramètres page consolidating maintenance toggle and account settings into two sections + - [x] New `public/admin/parametres.php` with Maintenance + Compte administrateur sections + - [x] Nav updated: “Compte” replaced by “Paramètres” linking to `parametres.php` + - [x] Maintenance bar removed from `index.php` + - [x] `actions/maintenance.php` and `actions/account.php` redirect to `parametres.php` via POST `redirect` param + - [x] CSS added for `.admin-settings-section` and `.admin-maintenance-status` - [x] Fix nav logo: revert to "Xamxam", apply display font (Combined), step-2 size, letter-spacing, text-shadow via .nav-logo class - [x] Bump all font sizes ~10% across all CSS files (admin, system, search, main, apropos, common, tfe) - [x] Migrate to utopia fluid type scale (--step--2 → --step-5) and space scale (--space-3xs → --space-3xl) across all CSS files diff --git a/public/admin/actions/account.php b/public/admin/actions/account.php index 52a19ab..628bcf4 100644 --- a/public/admin/actions/account.php +++ b/public/admin/actions/account.php @@ -23,15 +23,18 @@ $action = $_POST['action'] ?? 'change_password'; // ── Remove credentials ──────────────────────────────────────────────────────── if ($action === 'remove_credentials') { + $backUrl = $_POST['redirect'] ?? '/admin/parametres.php'; + if (!preg_match('#^/admin/#', $backUrl)) { $backUrl = '/admin/parametres.php'; } + if (!$hasPassword) { App::flash('error', 'Aucun fichier de mot de passe à supprimer.'); - header('Location: /admin/account.php'); + header('Location: ' . $backUrl); exit; } if (!is_writable($credentialsFile) && !is_writable(dirname($credentialsFile))) { App::flash('error', 'Le fichier de configuration n\'est pas accessible en écriture.'); - header('Location: /admin/account.php'); + header('Location: ' . $backUrl); exit; } @@ -42,7 +45,7 @@ if ($action === 'remove_credentials') { exit; } else { App::flash('error', 'Impossible de supprimer le fichier de configuration.'); - header('Location: /admin/account.php'); + header('Location: ' . $backUrl); exit; } } @@ -50,11 +53,14 @@ if ($action === 'remove_credentials') { // ── Change / set password ───────────────────────────────────────────────────── // 1. If a password is already set, verify the current one. +$backUrl = $_POST['redirect'] ?? '/admin/parametres.php'; +if (!preg_match('#^/admin/#', $backUrl)) { $backUrl = '/admin/parametres.php'; } + if ($hasPassword) { $currentPassword = $_POST['current_password'] ?? ''; if (!AdminAuth::login($currentPassword)) { App::flash('error', 'Mot de passe actuel incorrect.'); - header('Location: /admin/account.php'); + header('Location: ' . $backUrl); exit; } } @@ -65,13 +71,13 @@ $confirmPassword = $_POST['confirm_password'] ?? ''; if (strlen($newPassword) < 12) { App::flash('error', 'Le nouveau mot de passe doit contenir au moins 12 caractères.'); - header('Location: /admin/account.php'); + header('Location: ' . $backUrl); exit; } if ($newPassword !== $confirmPassword) { App::flash('error', 'Les mots de passe ne correspondent pas.'); - header('Location: /admin/account.php'); + header('Location: ' . $backUrl); exit; } @@ -79,7 +85,7 @@ if ($newPassword !== $confirmPassword) { $hash = password_hash($newPassword, PASSWORD_BCRYPT, ['cost' => 12]); if ($hash === false) { App::flash('error', 'Erreur lors du hachage du mot de passe.'); - header('Location: /admin/account.php'); + header('Location: ' . $backUrl); exit; } @@ -100,13 +106,13 @@ $tmpFile = $credentialsFile . '.tmp.' . bin2hex(random_bytes(6)); if (file_put_contents($tmpFile, $configContent, LOCK_EX) === false) { @unlink($tmpFile); App::flash('error', 'Impossible d\'écrire le fichier de configuration. Vérifiez les permissions sur config/.'); - header('Location: /admin/account.php'); + header('Location: ' . $backUrl); exit; } if (!rename($tmpFile, $credentialsFile)) { @unlink($tmpFile); App::flash('error', 'Impossible de mettre à jour le fichier de configuration.'); - header('Location: /admin/account.php'); + header('Location: ' . $backUrl); exit; } @@ -118,5 +124,5 @@ App::flash('success', $hasPassword ? 'Mot de passe mis à jour avec succès.' : 'Mot de passe défini avec succès. L\'authentification PHP est maintenant active.'); -header('Location: /admin/account.php'); +header('Location: ' . $backUrl); exit; diff --git a/public/admin/actions/maintenance.php b/public/admin/actions/maintenance.php index c318bb7..d6b42d5 100644 --- a/public/admin/actions/maintenance.php +++ b/public/admin/actions/maintenance.php @@ -24,5 +24,10 @@ if ($action === 'enable_maintenance') { App::flash('error', "Action inconnue."); } -header('Location: /admin/'); +$redirect = isset($_POST['redirect']) ? $_POST['redirect'] : '/admin/'; +// Allow only internal admin redirects for safety +if (!preg_match('#^/admin/#', $redirect)) { + $redirect = '/admin/'; +} +header('Location: ' . $redirect); exit(); diff --git a/public/admin/index.php b/public/admin/index.php index 6863ced..851bd6a 100644 --- a/public/admin/index.php +++ b/public/admin/index.php @@ -76,29 +76,6 @@ document.addEventListener('DOMContentLoaded', () => { - - - -
diff --git a/public/admin/parametres.php b/public/admin/parametres.php new file mode 100644 index 0000000..89ff67c --- /dev/null +++ b/public/admin/parametres.php @@ -0,0 +1,151 @@ + + + + +
+

Paramètres

+ + + + +
+

Maintenance

+ +
+ +

+ ⚠ Mode maintenance activé — le site public est inaccessible. +

+
+ + + + +
+ +

+ Site public : en ligne +

+
+ + + + +
+ +
+
+ + +
+

Compte administrateur

+ + + + + +

+ +
+ + + + +
+ +
+ +
+
+ + +
+ +
+ + Minimum 12 caractères. +
+
+ +
+ +
+ +
+
+ + +
+ + + +

Zone de danger

+
+

+ Supprimer la configuration du mot de passe PHP
+ + Supprime config/admin_credentials.php. L'accès admin + dépendra uniquement de l'authentification nginx Basic Auth si elle est configurée. + +

+
+ + + + + +
+
+ +
+
+ + diff --git a/public/assets/css/admin.css b/public/assets/css/admin.css index 8ea12de..c8d6998 100644 --- a/public/assets/css/admin.css +++ b/public/assets/css/admin.css @@ -905,6 +905,51 @@ margin-top: var(--space-2xs); } +/* ── Settings page sections ─────────────────────────────────────────────── */ +.admin-settings-section { + border: 1px solid var(--border-primary); + border-radius: 6px; + padding: var(--space-m) var(--space-l); + margin-bottom: var(--space-l); +} + +.admin-settings-section__title { + font-size: var(--step-0); + font-weight: 600; + letter-spacing: 0.07em; + text-transform: uppercase; + color: var(--text-secondary); + margin: 0 0 var(--space-m); + padding-bottom: var(--space-2xs); + border-bottom: 1px solid var(--border-primary); +} + +.admin-maintenance-status { + display: flex; + align-items: center; + justify-content: space-between; + gap: var(--space-s); + background: var(--bg-secondary); + border: 1px solid var(--border-primary); + border-radius: 4px; + padding: var(--space-xs) var(--space-m); + font-size: var(--step--1); +} + +.admin-maintenance-status--active { + background: var(--warning-muted-bg); + border-color: var(--warning); +} + +.admin-maintenance-status__msg { + margin: 0; +} + +.admin-maintenance-status form { + display: inline; + flex-shrink: 0; +} + /* ── Cancel link ────────────────────────────────────────────────────────── */ .admin-cancel-link { font-size: var(--step--1); diff --git a/templates/header.php b/templates/header.php index c0001ef..a60cee8 100644 --- a/templates/header.php +++ b/templates/header.php @@ -22,7 +22,7 @@ $_thesisId = $_GET['id'] ?? null;
  • >Pages statiques
  • >Mots-clés
  • >Système
  • -
  • >Compte
  • +
  • >Paramètres
  • >Modifier