Usuario o contraseña incorrectos

🔒 Acceso restringido. Solo personal autorizado.

window.__API_BASE__ = window.__API_BASE__ || 'https://tu-backend.up.railway.app'; if (localStorage.getItem('adminToken')) { window.location.href = 'admin.html'; } document.getElementById('loginForm').addEventListener('submit', async (e) => { e.preventDefault(); const email = document.getElementById('username').value; const pass = document.getElementById('password').value; try { const res = await fetch((window.__API_BASE__ ? `${window.__API_BASE__}/api` : '/api') + '/auth/admin/login', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ email, password: pass }) }); if (!res.ok) { document.getElementById('errorMsg').style.display = 'block'; return; } const data = await res.json(); localStorage.setItem('adminToken', data.token); localStorage.setItem('adminUser', JSON.stringify(data.user)); window.location.href = 'admin.html'; } catch (e) { document.getElementById('errorMsg').textContent = 'Error de conexión con el servidor'; document.getElementById('errorMsg').style.display = 'block'; } });