172 lines
5.3 KiB
HTML
172 lines
5.3 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="es" data-theme="light">
|
|
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>SekiPOS Login</title>
|
|
<link rel="shortcut icon" href="./static/favicon.png" type="image/x-icon">
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
<style>
|
|
:root {
|
|
--bg: #5865f2;
|
|
--card-bg: #ffffff;
|
|
--text: #2e3338;
|
|
--input-bg: #e3e5e8;
|
|
--accent: #5865f2;
|
|
--accent-hover: #4752c4;
|
|
--error: #ed4245;
|
|
}
|
|
|
|
[data-theme="dark"] {
|
|
--bg: #36393f;
|
|
--card-bg: #2f3136;
|
|
--text: #ffffff;
|
|
--input-bg: #202225;
|
|
}
|
|
|
|
body {
|
|
background: var(--bg);
|
|
font-family: "gg sans", "Segoe UI", sans-serif;
|
|
min-height: 100vh;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
transition: background 0.2s;
|
|
margin: 0;
|
|
padding: 16px;
|
|
}
|
|
|
|
.login-box {
|
|
background: var(--card-bg);
|
|
color: var(--text);
|
|
border-radius: 8px;
|
|
padding: 2rem;
|
|
width: 100%;
|
|
max-width: 400px;
|
|
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
|
|
transition: background 0.2s, color 0.2s;
|
|
}
|
|
|
|
.form-control {
|
|
background: var(--input-bg) !important;
|
|
color: var(--text) !important;
|
|
border: none;
|
|
}
|
|
|
|
.form-control:focus {
|
|
box-shadow: 0 0 0 2px var(--accent);
|
|
}
|
|
|
|
.form-control::placeholder {
|
|
color: #8a8e94;
|
|
}
|
|
|
|
.btn-login {
|
|
background: var(--accent);
|
|
color: #fff;
|
|
border: none;
|
|
font-weight: 600;
|
|
}
|
|
|
|
.btn-login:hover {
|
|
background: var(--accent-hover);
|
|
color: #fff;
|
|
}
|
|
|
|
.error-alert {
|
|
background: var(--error);
|
|
color: #fff;
|
|
border-radius: 4px;
|
|
font-size: .88rem;
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
<div class="login-box text-center">
|
|
<h2 class="fw-bold mb-1">SekiPOS</h2>
|
|
<p class="mb-4" style="opacity:.7;">¡Hola de nuevo!</p>
|
|
|
|
{% with messages = get_flashed_messages() %}
|
|
{% if messages %}
|
|
<div class="error-alert p-2 mb-3">{{ messages[0] }}</div>
|
|
{% endif %}
|
|
{% endwith %}
|
|
|
|
<form method="POST">
|
|
<input class="form-control mb-3" type="text" name="username" placeholder="Usuario" required autofocus>
|
|
<input class="form-control mb-3" type="password" name="password" placeholder="Contraseña" required>
|
|
<button type="submit" class="btn btn-login w-100">
|
|
Iniciar Sesión
|
|
</button>
|
|
</form>
|
|
</div>
|
|
|
|
<script>
|
|
/* ── Theme Management ── */
|
|
|
|
// Helper to set a cookie
|
|
function setCookie(name, value, days = 365) {
|
|
const d = new Date();
|
|
d.setTime(d.getTime() + (days * 24 * 60 * 60 * 1000));
|
|
let expires = "expires=" + d.toUTCString();
|
|
document.cookie = name + "=" + value + ";" + expires + ";path=/;SameSite=Lax";
|
|
}
|
|
|
|
// Helper to get a cookie
|
|
function getCookie(name) {
|
|
let nameEQ = name + "=";
|
|
let ca = document.cookie.split(';');
|
|
for (let i = 0; i < ca.length; i++) {
|
|
let c = ca[i];
|
|
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
|
|
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
function applyTheme(t) {
|
|
document.documentElement.setAttribute('data-theme', t);
|
|
const isDark = t === 'dark';
|
|
const themeIcon = document.getElementById('theme-icon');
|
|
const themeLabel = document.getElementById('theme-label');
|
|
|
|
if (themeIcon) themeIcon.className = isDark ? 'bi bi-sun me-2' : 'bi bi-moon-stars me-2';
|
|
if (themeLabel) themeLabel.innerText = isDark ? 'Modo Claro' : 'Modo Oscuro';
|
|
|
|
setCookie('theme', t);
|
|
}
|
|
|
|
function toggleTheme() {
|
|
const current = document.documentElement.getAttribute('data-theme');
|
|
const next = current === 'dark' ? 'light' : 'dark';
|
|
applyTheme(next);
|
|
}
|
|
|
|
// Initialization Logic
|
|
function initTheme() {
|
|
const savedTheme = getCookie('theme');
|
|
|
|
if (savedTheme) {
|
|
// Use user preference if it exists
|
|
applyTheme(savedTheme);
|
|
} else {
|
|
// Otherwise, detect OS preference
|
|
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
|
|
applyTheme(prefersDark ? 'dark' : 'light');
|
|
}
|
|
}
|
|
|
|
// Listen for OS theme changes in real-time if no cookie is set
|
|
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => {
|
|
if (!getCookie('theme')) {
|
|
applyTheme(e.matches ? 'dark' : 'light');
|
|
}
|
|
});
|
|
|
|
initTheme();
|
|
</script>
|
|
</body>
|
|
|
|
</html> |