59 lines
2.9 KiB
HTML
59 lines
2.9 KiB
HTML
{{define "setup"}}
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Setup - LLM Gateway</title>
|
|
<script src="https://unpkg.com/htmx.org@2.0.4"></script>
|
|
<script src="https://unpkg.com/htmx-ext-json-enc@2.0.1/json-enc.js"></script>
|
|
<style>
|
|
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: #0f172a; color: #e2e8f0; min-height: 100vh; display: flex; align-items: center; justify-content: center; }
|
|
.auth-box { background: #1e293b; border-radius: 12px; padding: 32px; width: 100%; max-width: 400px; }
|
|
.auth-box h1 { text-align: center; margin-bottom: 8px; font-size: 1.5rem; color: #f8fafc; }
|
|
.subtitle { text-align: center; color: #94a3b8; font-size: 0.9rem; margin-bottom: 24px; }
|
|
.form-group { margin-bottom: 16px; }
|
|
.form-group label { display: block; font-size: 0.85rem; color: #94a3b8; margin-bottom: 4px; }
|
|
.form-group input { width: 100%; padding: 10px 12px; background: #0f172a; border: 1px solid #334155; border-radius: 6px; color: #e2e8f0; font-size: 0.95rem; }
|
|
.form-group input:focus { outline: none; border-color: #3b82f6; }
|
|
.btn-primary { display: block; width: 100%; padding: 10px 20px; border-radius: 6px; border: none; cursor: pointer; font-size: 0.9rem; font-weight: 500; background: #3b82f6; color: #fff; }
|
|
.btn-primary:hover { background: #2563eb; }
|
|
.error-msg { background: #7f1d1d40; border: 1px solid #991b1b; color: #fca5a5; padding: 10px; border-radius: 6px; margin-bottom: 16px; font-size: 0.85rem; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="auth-box">
|
|
<h1>LLM Gateway Setup</h1>
|
|
<p class="subtitle">Create the first admin account</p>
|
|
<div id="setup-error"></div>
|
|
<form hx-post="/api/auth/setup" hx-target="#setup-error" hx-swap="innerHTML" hx-ext="json-enc">
|
|
<div class="form-group">
|
|
<label>Username</label>
|
|
<input type="text" name="username" required autocomplete="username">
|
|
</div>
|
|
<div class="form-group">
|
|
<label>Password (min 8 characters)</label>
|
|
<input type="password" name="password" required minlength="8" autocomplete="new-password">
|
|
</div>
|
|
<div class="form-group">
|
|
<label>Confirm Password</label>
|
|
<input type="password" id="setup-password2" required minlength="8" autocomplete="new-password">
|
|
</div>
|
|
<button type="submit" class="btn-primary">Create Admin Account</button>
|
|
</form>
|
|
</div>
|
|
<script>
|
|
document.body.addEventListener('htmx:confirm', function(e) {
|
|
var form = e.target;
|
|
if (!form.querySelector || !form.querySelector('#setup-password2')) return;
|
|
var pw = form.querySelector('[name=password]').value;
|
|
if (pw !== document.getElementById('setup-password2').value) {
|
|
e.preventDefault();
|
|
document.getElementById('setup-error').innerHTML = '<div class="error-msg">Passwords do not match</div>';
|
|
}
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|
|
{{end}}
|