Files
LiveFlow/app/static/login.html
T
Claude b802a3c95f Authentification : login/mot de passe (admin/admin par défaut)
- Page de connexion, session 7 jours par cookie HMAC signé (secret persisté)
- Protection de l'API (401) et du WebSocket (code 4401), / redirige vers /login
- Bouton de déconnexion, redirection automatique à l'expiration de session
- Identifiants configurables via LIVEFLOW_USER / LIVEFLOW_PASSWORD

https://claude.ai/code/session_01YHMp3EKzr4s6o8w1ygxuUe
2026-06-12 12:43:39 +00:00

64 lines
2.3 KiB
HTML

<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>LiveFlow — Connexion</title>
<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ctext y='.9em' font-size='90'%3E%F0%9F%8E%99%EF%B8%8F%3C/text%3E%3C/svg%3E">
<link rel="stylesheet" href="style.css">
<style>
body { align-items: center; justify-content: center; }
.login-box {
background: var(--panel);
border: 1px solid #262b3a;
border-radius: 14px;
padding: 32px;
width: min(360px, 90vw);
display: flex;
flex-direction: column;
gap: 14px;
}
.login-box h1 { font-size: 1.3rem; text-align: center; margin-bottom: 6px; }
.login-box input {
background: var(--panel-2);
border: 1px solid #2c3245;
color: var(--text);
padding: 11px 14px;
border-radius: 10px;
font-size: 0.95rem;
}
.login-box input:focus { outline: none; border-color: var(--accent); }
.login-box button { background: var(--accent); font-weight: 600; padding: 11px; }
#login-error { color: #ff8589; font-size: 0.85rem; text-align: center; min-height: 1.2em; }
</style>
</head>
<body>
<form class="login-box" id="login-form">
<h1>🎙️ LiveFlow</h1>
<input id="username" type="text" placeholder="Utilisateur" autocomplete="username" required autofocus>
<input id="password" type="password" placeholder="Mot de passe" autocomplete="current-password" required>
<button type="submit">Se connecter</button>
<div id="login-error"></div>
</form>
<script>
document.getElementById('login-form').addEventListener('submit', async (e) => {
e.preventDefault();
const resp = await fetch('/api/login', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
username: document.getElementById('username').value,
password: document.getElementById('password').value,
}),
});
if (resp.ok) {
location.href = '/';
} else {
document.getElementById('login-error').textContent = 'Identifiants invalides';
document.getElementById('password').value = '';
}
});
</script>
</body>
</html>