mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-07 03:29:19 +02:00
- admin/index.php: alert() → no-selection dialog; confirm() bulk actions → bulk-confirm/bulk-delete dialogs; confirm() single delete → delete-thesis dialog; removed redundant confirm on Dépublier (reversible action) - admin/tags.php: confirm() merge/delete → merge-tag/delete-tag dialogs - admin/acces-etudiante.php: confirm() delete link → delete-link dialog - admin/acces.php: confirm() archive link → archive-link dialog - admin/parametres.php: confirm() maintenance/delete-all → enable-maintenance/delete-all-tfe dialogs; admin password confirm() kept with TODO comment - admin/account.php: admin password confirm() kept with TODO comment - admin.css: add .admin-dialog--sm, .admin-dialog__alert, .admin-dialog__footer styles
88 lines
4.0 KiB
PHP
88 lines
4.0 KiB
PHP
<main id="main-content">
|
|
<h1>Compte administrateur</h1>
|
|
|
|
<!-- Status info -->
|
|
<dl class="admin-account-status">
|
|
<div class="admin-account-status__row">
|
|
<dt class="admin-account-status__label">Authentification PHP</dt>
|
|
<dd><?php $badgeType = 'ok'; $badgeValue = $hasPassword; $badgeOkLabel = 'Active'; $badgeWarnLabel = 'Non configurée'; include APP_ROOT . '/templates/partials/status-badge.php'; ?></dd>
|
|
</div>
|
|
<div class="admin-account-status__row">
|
|
<dt class="admin-account-status__label">Stockage</dt>
|
|
<dd>
|
|
<code class="admin-account-status__code">site_settings (DB)</code>
|
|
<?php $badgeType = 'ok'; $badgeValue = $hasPassword; $badgeOkLabel = 'Présent'; $badgeWarnLabel = 'Absent'; include APP_ROOT . '/templates/partials/status-badge.php'; ?>
|
|
</dd>
|
|
</div>
|
|
<?php if (!$hasPassword): ?>
|
|
<p class="admin-account-status__note">
|
|
Aucun mot de passe PHP configuré. Le formulaire ci-dessous stockera
|
|
un hash bcrypt dans la base de données.
|
|
</p>
|
|
<?php endif; ?>
|
|
</dl>
|
|
|
|
<!-- Password change form -->
|
|
<h2 class="admin-section-title"><?= $hasPassword ? 'Changer le mot de passe' : 'Définir le mot de passe' ?></h2>
|
|
|
|
<form method="post" action="/admin/actions/account.php" class="admin-form" autocomplete="off">
|
|
<input type="hidden" name="csrf_token" value="<?= htmlspecialchars($_SESSION['csrf_token']) ?>">
|
|
|
|
<?php if ($hasPassword): ?>
|
|
<div>
|
|
<label for="current_password">Mot de passe actuel</label>
|
|
<div>
|
|
<input type="password" id="current_password"
|
|
name="current_password" required autocomplete="current-password">
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<div>
|
|
<label for="new_password">Nouveau mot de passe</label>
|
|
<div>
|
|
<input type="password" id="new_password"
|
|
name="new_password" required autocomplete="new-password"
|
|
minlength="12">
|
|
<small>Minimum 12 caractères.</small>
|
|
</div>
|
|
</div>
|
|
|
|
<div>
|
|
<label for="confirm_password">Confirmer le mot de passe</label>
|
|
<div>
|
|
<input type="password" id="confirm_password"
|
|
name="confirm_password" required autocomplete="new-password">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="admin-form-footer">
|
|
<button type="submit" class="admin-btn">
|
|
<?= $hasPassword ? 'Mettre à jour le mot de passe' : 'Définir le mot de passe' ?>
|
|
</button>
|
|
</div>
|
|
</form>
|
|
|
|
<?php if ($hasPassword): ?>
|
|
<!-- Danger zone: remove password -->
|
|
<h2 class="admin-section-title admin-section-title--danger">Zone de danger</h2>
|
|
<div class="admin-danger-zone">
|
|
<p class="admin-danger-zone__description">
|
|
<strong>Supprimer la configuration du mot de passe PHP</strong><br>
|
|
<small>
|
|
Supprime le hash de la base de données. L'accès admin
|
|
dépendra uniquement de l'authentification nginx Basic Auth si elle est configurée.
|
|
</small>
|
|
</p>
|
|
<?php /* TODO: replace this browser confirm() with a proper <dialog> modal like the other confirmations */ ?>
|
|
<form method="post" action="/admin/actions/account.php"
|
|
onsubmit="return confirm('Supprimer le mot de passe PHP ? L\'accès admin ne sera protégé que par nginx Basic Auth.')">
|
|
<input type="hidden" name="csrf_token" value="<?= htmlspecialchars($_SESSION['csrf_token']) ?>">
|
|
<input type="hidden" name="action" value="remove_credentials">
|
|
<input type="hidden" name="current_password_remove" id="current_password_remove" value="">
|
|
<button type="submit" class="admin-btn admin-btn--danger">Supprimer</button>
|
|
</form>
|
|
</div>
|
|
<?php endif; ?>
|
|
</main>
|