feat: Hardcode 'admin' username for login and autofocus password
This commit is contained in:
@@ -33,13 +33,9 @@
|
|||||||
<h2 class="text-lg font-medium mb-2">Enter your credentials</h2>
|
<h2 class="text-lg font-medium mb-2">Enter your credentials</h2>
|
||||||
<div id="msg" class="hidden mb-3 rounded-lg border p-2 text-sm"></div>
|
<div id="msg" class="hidden mb-3 rounded-lg border p-2 text-sm"></div>
|
||||||
<form id="loginForm" class="space-y-3">
|
<form id="loginForm" class="space-y-3">
|
||||||
<div>
|
|
||||||
<label class="block text-sm mb-1">Username</label>
|
|
||||||
<input id="email" type="username" value="admin" required class="w-full rounded-lg border px-3 py-2 bg-white dark:bg-gray-800 dark:border-gray-700" />
|
|
||||||
</div>
|
|
||||||
<div>
|
<div>
|
||||||
<label class="block text-sm mb-1">Password</label>
|
<label class="block text-sm mb-1">Password</label>
|
||||||
<input id="password" type="password" required class="w-full rounded-lg border px-3 py-2 bg-white dark:bg-gray-800 dark:border-gray-700" />
|
<input id="password" type="password" required autofocus class="w-full rounded-lg border px-3 py-2 bg-white dark:bg-gray-800 dark:border-gray-700" />
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-center justify-between">
|
<div class="flex items-center justify-between">
|
||||||
<button class="rounded-xl bg-black text-white px-4 py-2 dark:bg-white dark:text-black" type="submit">Login</button>
|
<button class="rounded-xl bg-black text-white px-4 py-2 dark:bg-white dark:text-black" type="submit">Login</button>
|
||||||
@@ -59,7 +55,7 @@
|
|||||||
}
|
}
|
||||||
form.onsubmit = async (e)=>{
|
form.onsubmit = async (e)=>{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
const email = document.getElementById('email').value.trim();
|
const email = 'admin';
|
||||||
const password = document.getElementById('password').value;
|
const password = document.getElementById('password').value;
|
||||||
try{
|
try{
|
||||||
const r = await fetch('/api/login', { method:'POST', headers:{'Content-Type':'application/json','Accept':'application/json'}, body: JSON.stringify({email, password}) });
|
const r = await fetch('/api/login', { method:'POST', headers:{'Content-Type':'application/json','Accept':'application/json'}, body: JSON.stringify({email, password}) });
|
||||||
|
|||||||
Reference in New Issue
Block a user