Files
pyfleet/templates/login.html
T
2026-08-28 19:30:48 +02:00

299 lines
8.8 KiB
HTML
Executable File

<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>Acceso · Fleet</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Space+Grotesk:wght@600;700&display=swap" rel="stylesheet">
<script>
(function() {
var t = localStorage.getItem('nexus-theme') || 'light';
document.documentElement.setAttribute('data-theme', t);
})();
</script>
<style>
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
--bg: #f5f6fa;
--surface: #ffffff;
--border: #e3e6ef;
--accent: #5c6ef8;
--text: #1a1d29;
--muted: #8a8fa3;
--error-bg: rgba(248,113,113,.1);
--error-brd: rgba(248,113,113,.35);
--error-txt: #ef4444;
}
[data-theme="dark"] {
--bg: #0d0f14;
--surface: #13161e;
--border: #1e2230;
--text: #e2e6f0;
--muted: #5a607a;
}
body {
background: var(--bg);
color: var(--text);
font-family: 'Inter', sans-serif;
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
padding: 24px;
transition: background .2s, color .2s;
}
.login-wrap {
width: 100%;
max-width: 380px;
}
.login-logo {
text-align: center;
margin-bottom: 36px;
}
.login-logo .dot-row {
display: flex;
justify-content: center;
gap: 6px;
margin-bottom: 14px;
}
.login-logo .dot {
width: 10px; height: 10px;
border-radius: 50%;
background: var(--accent);
}
.login-logo .dot:nth-child(2) { opacity: .5; transform: scale(.8); }
.login-logo .dot:nth-child(3) { opacity: .25; transform: scale(.6); }
.login-logo h1 {
font-family: 'Space Grotesk', sans-serif;
font-size: 26px;
font-weight: 700;
letter-spacing: -0.5px;
}
.login-logo p {
margin-top: 6px;
font-size: 13px;
color: var(--muted);
}
.login-card {
background: var(--surface);
border: 1px solid var(--border);
border-radius: 14px;
padding: 32px;
}
.field-label {
display: block;
font-size: 11px;
font-weight: 600;
letter-spacing: .7px;
text-transform: uppercase;
color: var(--muted);
margin-bottom: 8px;
}
.pwd-wrap {
position: relative;
}
.pwd-wrap input {
width: 100%;
padding: 11px 42px 11px 14px;
background: var(--bg);
border: 1px solid var(--border);
border-radius: 8px;
color: var(--text);
font-family: 'Inter', sans-serif;
font-size: 15px;
outline: none;
transition: border-color .15s;
letter-spacing: 2px;
}
.pwd-wrap input::placeholder { letter-spacing: 0; color: var(--muted); }
.pwd-wrap input:focus { border-color: var(--accent); }
.toggle-pwd {
position: absolute;
right: 12px; top: 50%;
transform: translateY(-50%);
background: none;
border: none;
cursor: pointer;
color: var(--muted);
padding: 4px;
display: flex;
align-items: center;
}
.toggle-pwd:hover { color: var(--text); }
.error-msg {
display: flex;
align-items: center;
gap: 8px;
background: var(--error-bg);
border: 1px solid var(--error-brd);
color: var(--error-txt);
border-radius: 8px;
padding: 10px 14px;
font-size: 13px;
margin-bottom: 18px;
animation: shake .3s ease;
}
@keyframes shake {
0%,100% { transform: translateX(0); }
25% { transform: translateX(-6px); }
75% { transform: translateX(6px); }
}
.btn-login {
width: 100%;
margin-top: 20px;
padding: 12px;
background: var(--accent);
color: #fff;
border: none;
border-radius: 8px;
font-family: 'Inter', sans-serif;
font-size: 14px;
font-weight: 600;
cursor: pointer;
transition: opacity .15s;
}
.btn-login:hover { opacity: .88; }
.theme-btn {
display: flex;
align-items: center;
justify-content: center;
gap: 6px;
margin-top: 20px;
background: none;
border: none;
color: var(--muted);
font-family: 'Inter', sans-serif;
font-size: 12px;
cursor: pointer;
width: 100%;
padding: 6px;
border-radius: 6px;
transition: color .15s;
}
.theme-btn:hover { color: var(--text); }
</style>
</head>
<body>
<div class="login-wrap">
{% with messages = get_flashed_messages(with_categories=true) %}
{% for category, message in messages %}
<div style="
display:flex;align-items:center;gap:8px;
background:rgba({% if category == 'error' %}248,113,113{% else %}52,211,153{% endif %},.12);
border:1px solid rgba({% if category == 'error' %}248,113,113{% else %}52,211,153{% endif %},.35);
color:{% if category == 'error' %}#f87171{% else %}#34d399{% endif %};
border-radius:8px;padding:10px 14px;font-size:13px;margin-bottom:18px;">
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="12" cy="12" r="10"/>
<line x1="12" y1="8" x2="12" y2="12"/>
<line x1="12" y1="16" x2="12.01" y2="16"/>
</svg>
{{ message }}
</div>
{% endfor %}
{% endwith %}
<div class="login-logo">
<div class="dot-row">
<span class="dot"></span>
<span class="dot"></span>
<span class="dot"></span>
</div>
<h1>PyFleet</h1>
<p>Fleet Operations Platform</p>
<p>Introduce la contraseña para continuar</p>
</div>
<div class="login-card">
{% if error %}
<div class="error-msg">
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/>
</svg>
{{ error }}
</div>
{% endif %}
<label class="field-label" for="password">Contraseña</label>
<form method="POST" action="{{ url_for('login') }}">
<div class="pwd-wrap">
<input
type="password"
id="password"
name="password"
placeholder="••••••••"
autofocus
autocomplete="current-password"
>
<button type="button" class="toggle-pwd" id="togglePwd" aria-label="Mostrar contraseña">
<svg id="eyeIcon" width="17" height="17" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/><circle cx="12" cy="12" r="3"/>
</svg>
</button>
</div>
<button type="submit" class="btn-login">Entrar</button>
</form>
<button class="theme-btn" id="themeBtn" type="button">
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="12" cy="12" r="5"/><line x1="12" y1="1" x2="12" y2="3"/><line x1="12" y1="21" x2="12" y2="23"/>
<line x1="4.22" y1="4.22" x2="5.64" y2="5.64"/><line x1="18.36" y1="18.36" x2="19.78" y2="19.78"/>
<line x1="1" y1="12" x2="3" y2="12"/><line x1="21" y1="12" x2="23" y2="12"/>
<line x1="4.22" y1="19.78" x2="5.64" y2="18.36"/><line x1="18.36" y1="5.64" x2="19.78" y2="4.22"/>
</svg>
<span id="themeLabel">Cambiar tema</span>
</button>
</div>
</div>
<script>
/* Mostrar/ocultar contraseña */
var togglePwd = document.getElementById('togglePwd');
var pwdInput = document.getElementById('password');
var eyeIcon = document.getElementById('eyeIcon');
togglePwd.addEventListener('click', function() {
var visible = pwdInput.type === 'text';
pwdInput.type = visible ? 'password' : 'text';
eyeIcon.innerHTML = visible
? '<path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/><circle cx="12" cy="12" r="3"/>'
: '<path d="M17.94 17.94A10.07 10.07 0 0112 20c-7 0-11-8-11-8a18.45 18.45 0 015.06-5.94"/><path d="M9.9 4.24A9.12 9.12 0 0112 4c7 0 11 8 11 8a18.5 18.5 0 01-2.16 3.19"/><line x1="1" y1="1" x2="23" y2="23"/>';
});
/* Tema */
var html = document.documentElement;
var themeBtn = document.getElementById('themeBtn');
var themeLabel = document.getElementById('themeLabel');
function updateLabel() {
var isDark = html.getAttribute('data-theme') === 'dark';
themeLabel.textContent = isDark ? 'Modo claro' : 'Modo oscuro';
}
updateLabel();
themeBtn.addEventListener('click', function() {
var next = html.getAttribute('data-theme') === 'dark' ? 'light' : 'dark';
html.setAttribute('data-theme', next);
localStorage.setItem('nexus-theme', next);
updateLabel();
});
</script>
</body>
</html>