Add the admin CRM panel foundation including: - Login/logout authentication flow with CSRF protection - Sidebar layout with navigation for all CRM modules - Comprehensive admin.css (1680+ lines) with components for cards, tables, badges, forms, buttons, alerts, modals, pagination, search, responsive breakpoints, and print styles - admin.js with sidebar toggle, confirm dialogs, auto-dismiss alerts, and table search filtering Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
69 lines
2.5 KiB
PHP
69 lines
2.5 KiB
PHP
<?php
|
|
require_once __DIR__ . '/../includes/auth.php';
|
|
require_once __DIR__ . '/../includes/csrf.php';
|
|
|
|
authStart();
|
|
|
|
// Already logged in?
|
|
if (authCheck()) {
|
|
header('Location: index.php');
|
|
exit;
|
|
}
|
|
|
|
$error = '';
|
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
if (!csrfValidate()) {
|
|
$error = 'Token de seguridad inválido.';
|
|
} else {
|
|
$username = trim($_POST['username'] ?? '');
|
|
$password = $_POST['password'] ?? '';
|
|
if (authLogin($username, $password)) {
|
|
header('Location: index.php');
|
|
exit;
|
|
} else {
|
|
$error = 'Usuario o contraseña incorrectos.';
|
|
}
|
|
}
|
|
}
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="es">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Login - Gestoría LP Admin</title>
|
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
|
|
<link rel="stylesheet" href="../assets/css/admin.css">
|
|
</head>
|
|
<body class="login-page">
|
|
<div class="login-container">
|
|
<div class="login-card">
|
|
<div class="login-card__header">
|
|
<i class="fas fa-balance-scale"></i>
|
|
<h1>Gestoría LP</h1>
|
|
<p>Panel de Administración</p>
|
|
</div>
|
|
<?php if ($error): ?>
|
|
<div class="alert alert--danger"><?= htmlspecialchars($error) ?></div>
|
|
<?php endif; ?>
|
|
<form method="POST" class="login-form">
|
|
<?= csrfField() ?>
|
|
<div class="form-group">
|
|
<label for="username"><i class="fas fa-user"></i> Usuario</label>
|
|
<input type="text" id="username" name="username" required autofocus placeholder="Ingresa tu usuario">
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="password"><i class="fas fa-lock"></i> Contraseña</label>
|
|
<input type="password" id="password" name="password" required placeholder="Ingresa tu contraseña">
|
|
</div>
|
|
<button type="submit" class="btn btn--primary btn--block">
|
|
<i class="fas fa-sign-in-alt"></i> Iniciar Sesión
|
|
</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html>
|