mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-06 19:19:19 +02:00
47 lines
1.6 KiB
PHP
47 lines
1.6 KiB
PHP
<?php
|
|
require_once __DIR__ . '/../../config/bootstrap.php';
|
|
require_once __DIR__ . '/../../src/AdminAuth.php';
|
|
|
|
if (!defined('ADMIN_PASSWORD_HASH')) {
|
|
header('Location: /admin/');
|
|
exit;
|
|
}
|
|
if (AdminAuth::isAuthenticated()) {
|
|
header('Location: /admin/');
|
|
exit;
|
|
}
|
|
|
|
$error = '';
|
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
$password = $_POST['password'] ?? '';
|
|
if (AdminAuth::login($password)) {
|
|
header('Location: /admin/');
|
|
exit;
|
|
}
|
|
$error = 'Mot de passe incorrect.';
|
|
}
|
|
|
|
$pageTitle = 'Connexion';
|
|
?>
|
|
<?php require_once APP_ROOT . '/templates/admin/head.php'; ?>
|
|
|
|
<div class="admin-login-wrap">
|
|
<div class="admin-login-box">
|
|
<h2>Administration</h2>
|
|
<?php if ($error): ?>
|
|
<div class="admin-alert admin-alert--error">⚠ <?= htmlspecialchars($error) ?></div>
|
|
<?php endif; ?>
|
|
<form method="post" action="/admin/login.php" class="admin-form">
|
|
<div class="admin-form-row" style="grid-template-columns:1fr;border:none;padding:.4rem 0;">
|
|
<label class="admin-label" style="font-size:.82rem;color:var(--admin-text-muted);" for="password">Mot de passe</label>
|
|
<input class="admin-input" type="password" id="password" name="password" required autofocus>
|
|
</div>
|
|
<div class="admin-submit-wrap" style="margin-top:1rem;padding-top:.5rem;">
|
|
<button type="submit" class="admin-btn" style="width:100%;">Se connecter</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<?php require_once APP_ROOT . '/templates/admin/footer.php'; ?>
|