migrated to react
This commit is contained in:
@@ -1,44 +1,8 @@
|
||||
---
|
||||
import Layout from '../../layouts/Layout.astro';
|
||||
import Login from '../../components/react/admin/Login';
|
||||
---
|
||||
|
||||
<Layout title="Admin Login">
|
||||
<div class="max-w-md mx-auto mt-20">
|
||||
<div class="glass p-12">
|
||||
<h1 class="text-3xl font-bold mb-6 text-mauve">Admin Login</h1>
|
||||
<p class="text-subtext0 mb-8">Enter your admin token to access the dashboard.</p>
|
||||
|
||||
<form id="login-form" class="space-y-6">
|
||||
<div>
|
||||
<label for="token" class="block text-sm font-medium text-subtext1 mb-2">Admin Token</label>
|
||||
<input
|
||||
type="password"
|
||||
id="token"
|
||||
name="token"
|
||||
required
|
||||
class="w-full bg-crust border border-surface1 rounded-lg px-4 py-3 text-text focus:outline-none focus:border-mauve transition-colors"
|
||||
placeholder="••••••••••••"
|
||||
/>
|
||||
</div>
|
||||
<button
|
||||
type="submit"
|
||||
class="w-full bg-mauve text-crust font-bold py-3 rounded-lg hover:bg-pink transition-colors"
|
||||
>
|
||||
Login
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const form = document.getElementById('login-form');
|
||||
form?.addEventListener('submit', (e) => {
|
||||
e.preventDefault();
|
||||
const token = (document.getElementById('token') as HTMLInputElement).value;
|
||||
if (token) {
|
||||
localStorage.setItem('admin_token', token);
|
||||
window.location.href = '/admin';
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<Login client:load />
|
||||
</Layout>
|
||||
|
||||
Reference in New Issue
Block a user