74 lines
3.1 KiB
HTML
74 lines
3.1 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>NextNVR — Login</title>
|
|
<style>
|
|
:root { --bg: #0d1117; --surface: #161b22; --border: #30363d;
|
|
--text: #c9d1d9; --text-muted: #8b949e; --accent: #58a6ff;
|
|
--red: #f85149; --radius: 8px; }
|
|
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
|
body {
|
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
|
background: var(--bg); color: var(--text);
|
|
display: flex; align-items: center; justify-content: center;
|
|
min-height: 100vh;
|
|
}
|
|
.login-box {
|
|
background: var(--surface); border: 1px solid var(--border);
|
|
border-radius: var(--radius); padding: 32px; width: 100%; max-width: 360px;
|
|
}
|
|
.login-box h1 { font-size: 20px; text-align: center; margin-bottom: 24px; }
|
|
.login-box label { font-size: 12px; color: var(--text-muted); display: block; margin-top: 12px; }
|
|
.login-box input {
|
|
width: 100%; padding: 10px 12px; margin-top: 4px;
|
|
background: var(--bg); border: 1px solid var(--border);
|
|
color: var(--text); border-radius: 4px; font-size: 14px;
|
|
}
|
|
.login-box button {
|
|
width: 100%; margin-top: 20px; padding: 12px;
|
|
background: var(--accent); color: #fff; border: none;
|
|
border-radius: var(--radius); font-size: 14px; cursor: pointer;
|
|
}
|
|
.login-box button:hover { opacity: 0.9; }
|
|
.error { color: var(--red); font-size: 13px; margin-top: 8px; text-align: center; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="login-box">
|
|
<h1>🎥 NextNVR</h1>
|
|
<form id="login-form">
|
|
<label>Username</label>
|
|
<input type="text" id="username" autocomplete="username" required>
|
|
<label>Password</label>
|
|
<input type="password" id="password" autocomplete="current-password" required>
|
|
<button type="submit">Sign In</button>
|
|
</form>
|
|
<div class="error" id="error"></div>
|
|
</div>
|
|
<script>
|
|
document.getElementById('login-form').addEventListener('submit', async (e) => {
|
|
e.preventDefault();
|
|
const user = document.getElementById('username').value;
|
|
const pass = document.getElementById('password').value;
|
|
const err = document.getElementById('error');
|
|
try {
|
|
const r = await fetch('/api/login', {
|
|
method: 'POST',
|
|
headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({ username: user, password: pass })
|
|
});
|
|
const j = await r.json();
|
|
if (j.success) {
|
|
window.location.href = '/';
|
|
} else {
|
|
err.textContent = j.error || 'Login failed';
|
|
}
|
|
} catch(e) {
|
|
err.textContent = 'Connection error';
|
|
}
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|