195 lines
4.8 KiB
HTML
195 lines
4.8 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Login — Eaglercraft Load Tester</title>
|
|
<style>
|
|
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
|
|
|
body {
|
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
|
|
background: #0d1117;
|
|
color: #e6edf3;
|
|
min-height: 100vh;
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
|
|
.warning {
|
|
background: #4a1010;
|
|
border-bottom: 2px solid #f85149;
|
|
color: #ffa0a0;
|
|
text-align: center;
|
|
padding: 10px 16px;
|
|
font-size: 0.8rem;
|
|
font-weight: 600;
|
|
position: fixed;
|
|
top: 0;
|
|
left: 0;
|
|
right: 0;
|
|
}
|
|
.warning strong { color: #f85149; text-transform: uppercase; }
|
|
|
|
.login-card {
|
|
background: #1c2128;
|
|
border: 1px solid #30363d;
|
|
border-radius: 12px;
|
|
padding: 36px 32px;
|
|
width: 100%;
|
|
max-width: 380px;
|
|
box-shadow: 0 4px 24px rgba(0,0,0,0.4);
|
|
}
|
|
|
|
.login-card h1 {
|
|
font-size: 1.2rem;
|
|
text-align: center;
|
|
margin-bottom: 6px;
|
|
}
|
|
|
|
.login-card .subtitle {
|
|
text-align: center;
|
|
font-size: 0.78rem;
|
|
color: #8b949e;
|
|
margin-bottom: 24px;
|
|
}
|
|
|
|
.form-group {
|
|
margin-bottom: 16px;
|
|
}
|
|
|
|
.form-group label {
|
|
display: block;
|
|
font-size: 0.8rem;
|
|
color: #8b949e;
|
|
margin-bottom: 6px;
|
|
font-weight: 500;
|
|
}
|
|
|
|
.form-group input {
|
|
width: 100%;
|
|
background: #0d1117;
|
|
border: 1px solid #30363d;
|
|
border-radius: 6px;
|
|
color: #e6edf3;
|
|
padding: 10px 14px;
|
|
font-size: 0.9rem;
|
|
transition: border-color 0.2s;
|
|
}
|
|
|
|
.form-group input:focus {
|
|
outline: none;
|
|
border-color: #58a6ff;
|
|
}
|
|
|
|
.btn-login {
|
|
width: 100%;
|
|
background: #1f6feb;
|
|
border: 1px solid #388bfd;
|
|
border-radius: 6px;
|
|
color: #fff;
|
|
padding: 10px;
|
|
font-size: 0.9rem;
|
|
font-weight: 600;
|
|
cursor: pointer;
|
|
transition: background 0.2s;
|
|
}
|
|
|
|
.btn-login:hover { background: #388bfd; }
|
|
.btn-login:disabled { opacity: 0.5; cursor: not-allowed; }
|
|
|
|
.error-msg {
|
|
color: #f85149;
|
|
font-size: 0.8rem;
|
|
text-align: center;
|
|
margin-top: 12px;
|
|
min-height: 1.2em;
|
|
}
|
|
|
|
.footer {
|
|
position: fixed;
|
|
bottom: 0;
|
|
left: 0;
|
|
right: 0;
|
|
background: #161b22;
|
|
border-top: 1px solid #30363d;
|
|
text-align: center;
|
|
padding: 10px;
|
|
font-size: 0.7rem;
|
|
color: #6e7681;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<div class="warning">
|
|
<strong>FOR AUTHORIZED LOCAL TESTING ONLY</strong> — You must own the target server or have written permission.
|
|
</div>
|
|
|
|
<div class="login-card">
|
|
<h1>Eaglercraft Load Tester</h1>
|
|
<p class="subtitle">Enter password to access the dashboard</p>
|
|
<form id="login-form">
|
|
<div class="form-group">
|
|
<label for="password">Password</label>
|
|
<input type="password" id="password" placeholder="Enter password" autofocus />
|
|
</div>
|
|
<button type="submit" class="btn-login" id="btn-login">Unlock</button>
|
|
<div class="error-msg" id="error-msg"></div>
|
|
</form>
|
|
</div>
|
|
|
|
<div class="footer">
|
|
Eaglercraft Load-Testing Dashboard — MC 1.8 Protocol — Authorized testing only.
|
|
</div>
|
|
|
|
<script>
|
|
// If already authenticated, redirect to dashboard
|
|
fetch('/api/auth/check')
|
|
.then(r => r.json())
|
|
.then(data => {
|
|
if (data.authenticated) window.location.href = '/';
|
|
})
|
|
.catch(() => {});
|
|
|
|
const form = document.getElementById('login-form');
|
|
const errorMsg = document.getElementById('error-msg');
|
|
const btnLogin = document.getElementById('btn-login');
|
|
|
|
form.addEventListener('submit', async (e) => {
|
|
e.preventDefault();
|
|
const password = document.getElementById('password').value;
|
|
if (!password) return;
|
|
|
|
errorMsg.textContent = '';
|
|
btnLogin.disabled = true;
|
|
btnLogin.textContent = 'Checking...';
|
|
|
|
try {
|
|
const res = await fetch('/api/auth/login', {
|
|
method: 'POST',
|
|
headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({ password })
|
|
});
|
|
const data = await res.json();
|
|
|
|
if (res.ok && data.success) {
|
|
window.location.href = '/';
|
|
} else {
|
|
errorMsg.textContent = data.error || 'Invalid password';
|
|
btnLogin.disabled = false;
|
|
btnLogin.textContent = 'Unlock';
|
|
document.getElementById('password').select();
|
|
}
|
|
} catch (err) {
|
|
errorMsg.textContent = 'Network error';
|
|
btnLogin.disabled = false;
|
|
btnLogin.textContent = 'Unlock';
|
|
}
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|