social-reporting-tool/frontend/login.html
DJP c5c40aa4e5 Add server deployment: Apache proxy, static frontend, deploy script
- Static frontend (index.html, login.html, config.js) for Apache serving
- JSON-based auth API endpoints (/api/login, /api/auth, /api/logout)
- Apache config with ProxyPass for /social-reports path
- deploy/setup.sh for Ubuntu + Apache + Docker deployment
- docker-compose.prod.yml binds ports to 127.0.0.1 only
- Configurable API base URL via frontend/config.js

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-07 11:23:47 -04:00

69 lines
3.4 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Login — Social Listening</title>
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800&display=swap" rel="stylesheet">
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Montserrat', sans-serif; background: #0a0a0a; color: #e0e0e0; min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-box { background: #141414; border: 1px solid #2a2a2a; border-radius: 16px; padding: 40px; width: 100%; max-width: 380px; }
.login-box h1 { font-size: 22px; font-weight: 800; margin-bottom: 6px; letter-spacing: -0.3px; }
.login-box .sub { font-size: 13px; color: #666; margin-bottom: 28px; }
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: #888; margin-bottom: 6px; }
.field input { width: 100%; background: #1a1a1a; border: 1px solid #333; border-radius: 8px; padding: 12px 14px; color: #e0e0e0; font-size: 14px; font-family: 'Montserrat', sans-serif; }
.field input:focus { outline: none; border-color: #f5a623; }
.error { background: #3a1b1b; color: #f44336; border: 1px solid #5a2020; border-radius: 8px; padding: 10px 14px; font-size: 12px; font-weight: 600; margin-bottom: 18px; display: none; }
button { width: 100%; background: #f5a623; color: #000; border: none; border-radius: 8px; padding: 14px; font-size: 15px; font-weight: 700; cursor: pointer; font-family: 'Montserrat', sans-serif; letter-spacing: 0.5px; }
button:hover { background: #e69920; }
button:disabled { background: #333; color: #666; cursor: not-allowed; }
</style>
</head>
<body>
<div class="login-box">
<h1>Social Listening</h1>
<div class="sub">Sign in to access the dashboard</div>
<div class="error" id="errorMsg"></div>
<form id="loginForm">
<div class="field"><label>Username</label><input name="username" id="username" type="text" autocomplete="username" required autofocus></div>
<div class="field"><label>Password</label><input name="password" id="password" type="password" autocomplete="current-password" required></div>
<button type="submit" id="submitBtn">Sign In</button>
</form>
</div>
<script src="config.js"></script>
<script>
const API = window.__API_BASE || '';
document.getElementById('loginForm').addEventListener('submit', async (e) => {
e.preventDefault();
const btn = document.getElementById('submitBtn');
const err = document.getElementById('errorMsg');
btn.disabled = true; btn.textContent = 'Signing in...';
err.style.display = 'none';
try {
const res = await fetch(API + '/api/login', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
credentials: 'include',
body: JSON.stringify({
username: document.getElementById('username').value,
password: document.getElementById('password').value,
}),
});
const data = await res.json();
if (data.ok) {
window.location.href = './';
} else {
err.textContent = data.error || 'Invalid username or password';
err.style.display = 'block';
}
} catch (ex) {
err.textContent = 'Connection failed: ' + ex.message;
err.style.display = 'block';
}
btn.disabled = false; btn.textContent = 'Sign In';
});
</script>
</body>
</html>