Sign in
Use the admin created by backend setup.
If this is a fresh install, run /backend/api/bootstrap.php?path=auth/setup once.
if (localStorage.getItem('token')) location.href = 'dashboard.html'; document.getElementById('loginForm').addEventListener('submit', async (e) => { e.preventDefault(); const fd = new FormData(e.target); const email = fd.get('email'); const password = fd.get('password'); const err = document.getElementById('err'); err.classList.add('hidden'); try { const res = await API.req('auth/login', { method: 'POST', body: { email, password }}); localStorage.setItem('token', res.token); localStorage.setItem('user', JSON.stringify(res.user)); // role-based redirect location.href = (res.user.role === 'Admin') ? 'dashboard.html' : 'dashboard.html'; } catch (ex) { err.textContent = ex.message || 'Login failed'; err.classList.remove('hidden'); } });