92 lines
3.1 KiB
PHP
92 lines
3.1 KiB
PHP
<?php
|
|
// ================================================================
|
|
// Admin Login — WebGIS Sebaran Penduduk Miskin
|
|
// ================================================================
|
|
require_once __DIR__ . '/../config/config.php';
|
|
require_once __DIR__ . '/../includes/auth.php';
|
|
|
|
// Jika sudah login, redirect ke dashboard
|
|
if (isLoggedIn()) {
|
|
header('Location: ' . BASE_URL . '/admin/');
|
|
exit;
|
|
}
|
|
|
|
$error = $_GET['error'] ?? '';
|
|
$errorMsg = match($error) {
|
|
'empty' => 'Email dan password tidak boleh kosong.',
|
|
'invalid' => 'Email atau password salah.',
|
|
default => ''
|
|
};
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="id">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Login — <?= APP_NAME ?></title>
|
|
<meta name="description" content="Login Admin WebGIS Sebaran Penduduk Miskin">
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css" rel="stylesheet">
|
|
<link href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap" rel="stylesheet">
|
|
<link rel="stylesheet" href="<?= BASE_URL ?>/assets/css/admin.css">
|
|
</head>
|
|
<body>
|
|
|
|
<div class="login-page">
|
|
<div class="login-card">
|
|
|
|
<!-- Logo -->
|
|
<div class="login-logo">
|
|
<div class="login-logo-icon">🗺️</div>
|
|
<h1><?= APP_NAME ?></h1>
|
|
<p>Portal Admin · v<?= APP_VERSION ?></p>
|
|
</div>
|
|
|
|
<!-- Error Alert -->
|
|
<?php if ($errorMsg): ?>
|
|
<div class="alert alert-danger" style="margin-bottom:18px;" id="login-error">
|
|
<i class="bi bi-exclamation-circle-fill"></i> <?= htmlspecialchars($errorMsg) ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<!-- Form -->
|
|
<form action="<?= BASE_URL ?>/admin/auth_action.php" method="POST" id="login-form">
|
|
<div class="form-group">
|
|
<label class="form-label">Alamat Email</label>
|
|
<div class="login-input">
|
|
<i class="bi bi-envelope-fill"></i>
|
|
<input type="email" name="email" id="login-email"
|
|
placeholder="admin@povertymap.id"
|
|
value="<?= htmlspecialchars($_GET['email'] ?? '') ?>"
|
|
required autocomplete="email">
|
|
</div>
|
|
</div>
|
|
<div class="form-group" style="margin-bottom:20px;">
|
|
<label class="form-label">Password</label>
|
|
<div class="login-input">
|
|
<i class="bi bi-lock-fill"></i>
|
|
<input type="password" name="password" id="login-password"
|
|
placeholder="••••••••" required autocomplete="current-password">
|
|
</div>
|
|
</div>
|
|
<button type="submit" class="login-btn" id="btn-login">
|
|
<i class="bi bi-box-arrow-in-right"></i> Masuk ke Dashboard
|
|
</button>
|
|
</form>
|
|
|
|
<div class="login-footer">
|
|
<i class="bi bi-shield-lock"></i> Sistem diproteksi — Akses terbatas untuk staf berwenang
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
document.getElementById('login-form').addEventListener('submit', function() {
|
|
const btn = document.getElementById('btn-login');
|
|
btn.disabled = true;
|
|
btn.innerHTML = '<i class="bi bi-hourglass-split"></i> Memverifikasi...';
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|