revert: restore admin/index.php to pre-login-fix state

This commit is contained in:
2026-06-01 09:30:57 +00:00
parent d4a6d8359e
commit f30f0fdfad
+9 -16
View File
@@ -943,7 +943,7 @@ select.filter-sel:focus{border-color:var(--cyan)}
<div id="toast"></div> <div id="toast"></div>
<script data-cfasync="false"> <script>
// ── UTILS ───────────────────────────────────────────────────────────────────── // ── UTILS ─────────────────────────────────────────────────────────────────────
let _alertFilter = 'active'; let _alertFilter = 'active';
let _modalCb = null; let _modalCb = null;
@@ -993,22 +993,15 @@ function statusBadge(s) {
// ── AUTH ────────────────────────────────────────────────────────────────────── // ── AUTH ──────────────────────────────────────────────────────────────────────
async function doLogin() { async function doLogin() {
const btn=document.querySelector('#loginBox .btn');
const err=document.getElementById('loginErr');
const u=document.getElementById('lu').value.trim(), p=document.getElementById('lp').value; const u=document.getElementById('lu').value.trim(), p=document.getElementById('lp').value;
if (!u||!p){err.textContent='Enter username and password';return;} const fd=new FormData(); fd.append('action','login'); fd.append('username',u); fd.append('password',p);
btn.disabled=true; btn.textContent='AUTHENTICATING...'; err.textContent=''; const r = await fetch(location.href,{method:'POST',body:fd});
try { const d = await r.json();
const fd=new FormData(); fd.append('action','login'); fd.append('username',u); fd.append('password',p); if (d.error) { document.getElementById('loginErr').textContent=d.error; return; }
const r = await fetch(location.href,{method:'POST',body:fd}); document.getElementById('loginWrap').style.display='none';
const d = await r.json(); document.getElementById('app').style.display='flex';
if (d.error) { err.textContent=d.error; return; } document.getElementById('adminUser').textContent = (d.name||u).toUpperCase();
document.getElementById('loginWrap').style.display='none'; initApp();
document.getElementById('app').style.display='flex';
document.getElementById('adminUser').textContent = (d.name||u).toUpperCase();
initApp();
} catch(e) { err.textContent='Connection error — try again'; }
finally { btn.disabled=false; btn.textContent='AUTHENTICATE'; }
} }
async function doLogout() { async function doLogout() {