Replace Nginx basic auth with proper user accounts: - Session cookies via itsdangerous (30-day expiry, httponly, secure) - Password hashing with bcrypt via passlib - Login page with AC-themed UI - Admin page for user management (CRUD) - AuthMiddleware exempts plugin WS and browser WS endpoints - Issues/comments author auto-populated from session - Sidebar shows logged-in username, admin link, and logout - Seed users: erik (admin), alex, lundberg - SECRET_KEY env var for cookie signing
169 lines
4.8 KiB
HTML
169 lines
4.8 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Dereth Tracker - Login</title>
|
|
<style>
|
|
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
body {
|
|
min-height: 100vh;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
background: #0a0a0a;
|
|
background-image:
|
|
radial-gradient(ellipse at 50% 30%, rgba(30, 20, 10, 0.8) 0%, transparent 70%),
|
|
linear-gradient(180deg, #0a0806 0%, #12100a 50%, #0a0806 100%);
|
|
font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
|
|
color: #d4c9a8;
|
|
}
|
|
.login-card {
|
|
width: 360px;
|
|
background: linear-gradient(180deg, #1a1610 0%, #0e0c08 100%);
|
|
border: 2px solid #8a7a44;
|
|
border-radius: 6px;
|
|
padding: 32px 28px;
|
|
box-shadow:
|
|
inset 0 1px 0 rgba(212, 175, 55, 0.1),
|
|
0 8px 32px rgba(0, 0, 0, 0.8),
|
|
0 0 60px rgba(138, 122, 68, 0.08);
|
|
}
|
|
.login-title {
|
|
text-align: center;
|
|
margin-bottom: 6px;
|
|
font-size: 1.5rem;
|
|
color: #d4af37;
|
|
text-shadow: 0 1px 3px rgba(0,0,0,0.6);
|
|
letter-spacing: 1px;
|
|
}
|
|
.login-subtitle {
|
|
text-align: center;
|
|
font-size: 0.8rem;
|
|
color: #8a7a5a;
|
|
margin-bottom: 24px;
|
|
}
|
|
.form-group {
|
|
margin-bottom: 16px;
|
|
}
|
|
.form-group label {
|
|
display: block;
|
|
font-size: 0.8rem;
|
|
color: #a09070;
|
|
margin-bottom: 4px;
|
|
text-transform: uppercase;
|
|
letter-spacing: 1px;
|
|
}
|
|
.form-group input {
|
|
width: 100%;
|
|
padding: 10px 12px;
|
|
font-size: 0.95rem;
|
|
font-family: inherit;
|
|
background: #0e0c08;
|
|
color: #d4c9a8;
|
|
border: 1px solid #5a4a24;
|
|
border-radius: 3px;
|
|
outline: none;
|
|
transition: border-color 0.2s;
|
|
}
|
|
.form-group input:focus {
|
|
border-color: #d4af37;
|
|
box-shadow: 0 0 6px rgba(212, 175, 55, 0.15);
|
|
}
|
|
.login-btn {
|
|
width: 100%;
|
|
padding: 10px;
|
|
margin-top: 8px;
|
|
font-family: inherit;
|
|
font-size: 1rem;
|
|
font-weight: bold;
|
|
color: #1a1610;
|
|
background: linear-gradient(180deg, #d4af37 0%, #a08520 100%);
|
|
border: 1px solid #8a7a44;
|
|
border-radius: 3px;
|
|
cursor: pointer;
|
|
text-transform: uppercase;
|
|
letter-spacing: 2px;
|
|
transition: background 0.2s, box-shadow 0.2s;
|
|
}
|
|
.login-btn:hover {
|
|
background: linear-gradient(180deg, #e0c050 0%, #b89a30 100%);
|
|
box-shadow: 0 2px 8px rgba(212, 175, 55, 0.3);
|
|
}
|
|
.login-btn:active {
|
|
background: linear-gradient(180deg, #a08520 0%, #8a7a44 100%);
|
|
}
|
|
.login-error {
|
|
margin-top: 12px;
|
|
padding: 8px;
|
|
text-align: center;
|
|
font-size: 0.8rem;
|
|
color: #ff6b6b;
|
|
background: rgba(255, 50, 50, 0.08);
|
|
border: 1px solid rgba(255, 50, 50, 0.2);
|
|
border-radius: 3px;
|
|
display: none;
|
|
}
|
|
.login-footer {
|
|
margin-top: 20px;
|
|
text-align: center;
|
|
font-size: 0.65rem;
|
|
color: #5a4a34;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="login-card">
|
|
<h1 class="login-title">Dereth Tracker</h1>
|
|
<p class="login-subtitle">Mosswart Enjoyers Club</p>
|
|
|
|
<form id="loginForm" onsubmit="return handleLogin(event)">
|
|
<div class="form-group">
|
|
<label for="username">Username</label>
|
|
<input type="text" id="username" name="username" autocomplete="username" autofocus required>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="password">Password</label>
|
|
<input type="password" id="password" name="password" autocomplete="current-password" required>
|
|
</div>
|
|
<button type="submit" class="login-btn" id="loginBtn">Enter Dereth</button>
|
|
<div class="login-error" id="loginError"></div>
|
|
</form>
|
|
|
|
<div class="login-footer">Authorized personnel only</div>
|
|
</div>
|
|
|
|
<script>
|
|
async function handleLogin(e) {
|
|
e.preventDefault();
|
|
const btn = document.getElementById('loginBtn');
|
|
const errDiv = document.getElementById('loginError');
|
|
errDiv.style.display = 'none';
|
|
btn.textContent = 'Authenticating...';
|
|
btn.disabled = true;
|
|
|
|
try {
|
|
const resp = await fetch('/login', {
|
|
method: 'POST',
|
|
headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({
|
|
username: document.getElementById('username').value,
|
|
password: document.getElementById('password').value,
|
|
}),
|
|
});
|
|
if (resp.ok) {
|
|
window.location.href = '/';
|
|
return;
|
|
}
|
|
const data = await resp.json();
|
|
errDiv.textContent = data.detail || 'Login failed';
|
|
errDiv.style.display = 'block';
|
|
} catch (err) {
|
|
errDiv.textContent = 'Connection error';
|
|
errDiv.style.display = 'block';
|
|
}
|
|
btn.textContent = 'Enter Dereth';
|
|
btn.disabled = false;
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|