88 lines
4.0 KiB
HTML
88 lines
4.0 KiB
HTML
{{define "content"}}
|
|
<div class="w-full max-w-md px-6">
|
|
<!-- Logo -->
|
|
<div class="text-center mb-10">
|
|
<h1 class="text-3xl font-bold text-white tracking-tight">
|
|
<span class="text-[#c9a84c]">Deal</span>space
|
|
</h1>
|
|
<p class="text-[#b0bec5] mt-2 text-sm">First-time setup</p>
|
|
</div>
|
|
|
|
<!-- Setup Card -->
|
|
<div class="bg-[#0d1f3c] border border-white/[0.08] rounded-xl p-8">
|
|
<h2 class="text-xl font-semibold text-white mb-2">Create admin account</h2>
|
|
<p class="text-[#b0bec5] text-sm mb-6">This will be the first administrator account for your Dealspace instance.</p>
|
|
|
|
<div id="error" class="hidden mb-4 p-3 bg-red-500/10 border border-red-500/20 rounded-lg text-red-400 text-sm"></div>
|
|
<div id="success" class="hidden mb-4 p-3 bg-green-500/10 border border-green-500/20 rounded-lg text-green-400 text-sm"></div>
|
|
|
|
<form id="setupForm" class="space-y-5">
|
|
<div>
|
|
<label for="name" class="block text-sm font-medium text-[#b0bec5] mb-1.5">Full name</label>
|
|
<input type="text" id="name" name="name" required autofocus
|
|
class="w-full px-4 py-2.5 bg-[#0a1628] border border-white/[0.08] rounded-lg text-white placeholder-[#8899a6] focus:outline-none focus:border-[#c9a84c] focus:ring-1 focus:ring-[#c9a84c] transition">
|
|
</div>
|
|
<div>
|
|
<label for="email" class="block text-sm font-medium text-[#b0bec5] mb-1.5">Email</label>
|
|
<input type="email" id="email" name="email" required autocomplete="email"
|
|
class="w-full px-4 py-2.5 bg-[#0a1628] border border-white/[0.08] rounded-lg text-white placeholder-[#8899a6] focus:outline-none focus:border-[#c9a84c] focus:ring-1 focus:ring-[#c9a84c] transition">
|
|
</div>
|
|
<div>
|
|
<label for="password" class="block text-sm font-medium text-[#b0bec5] mb-1.5">Password</label>
|
|
<input type="password" id="password" name="password" required minlength="8" autocomplete="new-password"
|
|
class="w-full px-4 py-2.5 bg-[#0a1628] border border-white/[0.08] rounded-lg text-white placeholder-[#8899a6] focus:outline-none focus:border-[#c9a84c] focus:ring-1 focus:ring-[#c9a84c] transition">
|
|
<p class="text-xs text-[#8899a6] mt-1">Minimum 8 characters</p>
|
|
</div>
|
|
<button type="submit" id="submitBtn"
|
|
class="w-full py-2.5 bg-[#c9a84c] hover:bg-[#b8973f] text-[#0a1628] font-semibold rounded-lg transition disabled:opacity-50">
|
|
Create account
|
|
</button>
|
|
</form>
|
|
</div>
|
|
|
|
<p class="text-center text-[#8899a6] text-xs mt-8">© 2026 Muskepo B.V. — Amsterdam</p>
|
|
</div>
|
|
{{end}}
|
|
|
|
{{define "scripts"}}
|
|
<script>
|
|
document.getElementById('setupForm').addEventListener('submit', async (e) => {
|
|
e.preventDefault();
|
|
const btn = document.getElementById('submitBtn');
|
|
const errorEl = document.getElementById('error');
|
|
const successEl = document.getElementById('success');
|
|
btn.disabled = true;
|
|
btn.textContent = 'Creating...';
|
|
errorEl.classList.add('hidden');
|
|
successEl.classList.add('hidden');
|
|
|
|
try {
|
|
const res = await fetch('/api/setup', {
|
|
method: 'POST',
|
|
headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({
|
|
name: document.getElementById('name').value,
|
|
email: document.getElementById('email').value,
|
|
password: document.getElementById('password').value,
|
|
}),
|
|
});
|
|
|
|
const data = await res.json();
|
|
|
|
if (!res.ok) {
|
|
throw new Error(data.error || 'Setup failed');
|
|
}
|
|
|
|
successEl.textContent = 'Admin account created! Redirecting to login...';
|
|
successEl.classList.remove('hidden');
|
|
setTimeout(() => { window.location.href = '/app/login'; }, 1500);
|
|
} catch (err) {
|
|
errorEl.textContent = err.message;
|
|
errorEl.classList.remove('hidden');
|
|
btn.disabled = false;
|
|
btn.textContent = 'Create account';
|
|
}
|
|
});
|
|
</script>
|
|
{{end}}
|