+ Compte administrateur
+
+
+ ⚠ = htmlspecialchars($error) ?>
+
+
+ ✓ = htmlspecialchars($success) ?>
+
+
+
+
+
+ Authentification PHP
+
+ Active
+
+ Non configurée
+
+
+
+ Fichier de configuration
+ config/admin_credentials.php
+
+ Présent
+
+ Absent
+
+
+
+
+ Aucun mot de passe PHP configuré. Le formulaire ci-dessous créera
+ config/admin_credentials.php avec un hash bcrypt.
+
+
+
+
+
+ = $hasPassword ? 'Changer le mot de passe' : 'Définir le mot de passe' ?>
+
+
+
+
+
+ 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/admin/actions/account.php b/public/admin/actions/account.php
new file mode 100644
index 0000000..4fe5b6f
--- /dev/null
+++ b/public/admin/actions/account.php
@@ -0,0 +1,122 @@
+ 12]);
+if ($hash === false) {
+ $_SESSION['error'] = 'Erreur lors du hachage du mot de passe.';
+ header('Location: /admin/account.php');
+ exit;
+}
+
+// 4. Write credentials file.
+$configContent = ' 12]);"' . "\n"
+ . ' */' . "\n"
+ . "\n"
+ . 'define(\'ADMIN_PASSWORD_HASH\', ' . var_export($hash, true) . ');' . "\n";
+
+// Write atomically via a temp file.
+$tmpFile = $credentialsFile . '.tmp.' . bin2hex(random_bytes(6));
+if (file_put_contents($tmpFile, $configContent, LOCK_EX) === false) {
+ @unlink($tmpFile);
+ $_SESSION['error'] = 'Impossible d\'écrire le fichier de configuration. Vérifiez les permissions sur config/.';
+ header('Location: /admin/account.php');
+ exit;
+}
+if (!rename($tmpFile, $credentialsFile)) {
+ @unlink($tmpFile);
+ $_SESSION['error'] = 'Impossible de mettre à jour le fichier de configuration.';
+ header('Location: /admin/account.php');
+ exit;
+}
+
+// 5. Regenerate session (password changed — invalidate old sessions).
+session_regenerate_id(true);
+$_SESSION['admin_authenticated'] = true;
+
+$_SESSION['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');
+exit;
diff --git a/public/assets/admin.css b/public/assets/admin.css
index a1f12ff..1c8e048 100644
--- a/public/assets/admin.css
+++ b/public/assets/admin.css
@@ -734,3 +734,77 @@ html, body {
color: #cc6060;
border: 1px solid #7a2020;
}
+
+/* ---- Account page ---- */
+.admin-account-status {
+ background: var(--admin-bg-alt);
+ border: 1px solid var(--admin-border);
+ border-radius: 4px;
+ padding: 1.25rem 1.5rem;
+ margin-bottom: 2.5rem;
+ display: flex;
+ flex-direction: column;
+ gap: 0.75rem;
+}
+
+.admin-account-status__row {
+ display: flex;
+ align-items: center;
+ gap: 0.75rem;
+ font-size: 0.9rem;
+}
+
+.admin-account-status__label {
+ color: var(--admin-text-muted);
+ min-width: 220px;
+}
+
+.admin-account-status__code {
+ font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
+ font-size: 0.82rem;
+ background: var(--admin-bg);
+ border: 1px solid var(--admin-border);
+ border-radius: 3px;
+ padding: 0.1rem 0.4rem;
+ color: var(--admin-text-muted);
+}
+
+.admin-account-status__note {
+ font-size: 0.88rem;
+ color: #ffc107;
+ margin: 0.25rem 0 0;
+}
+
+.admin-section-title {
+ font-size: 1rem;
+ font-weight: 600;
+ letter-spacing: 0.07em;
+ text-transform: uppercase;
+ color: var(--admin-text-muted);
+ margin: 0 0 1.25rem;
+ padding-bottom: 0.5rem;
+ border-bottom: 1px solid var(--admin-border);
+}
+
+.admin-field-hint {
+ font-size: 0.8rem;
+ color: var(--admin-text-muted);
+ margin: 0.3rem 0 0;
+}
+
+.admin-danger-zone {
+ background: rgba(180, 0, 0, 0.07);
+ border: 1px solid rgba(200, 60, 60, 0.3);
+ border-radius: 4px;
+ padding: 1.25rem 1.5rem;
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 1.5rem;
+ flex-wrap: wrap;
+}
+
+.admin-danger-zone__description {
+ font-size: 0.9rem;
+ line-height: 1.5;
+}
diff --git a/templates/admin/head.php b/templates/admin/head.php
index 7245c69..309662c 100644
--- a/templates/admin/head.php
+++ b/templates/admin/head.php
@@ -31,6 +31,7 @@