admin fix

This commit is contained in:
roman
2026-06-10 23:00:58 +02:00
parent 43011f0a77
commit 639baafe4a
2 changed files with 33 additions and 3 deletions
+14 -3
View File
@@ -363,8 +363,8 @@
<div id="login-form">
<div class="fg"><label>Email alebo meno</label><input type="text" id="l-email" placeholder="admin" /></div>
<div class="fg"><label>Heslo</label><input type="password" id="l-pass" placeholder="••••••••" onkeydown="if(event.key==='Enter')doLogin()" /></div>
<button class="btn-primary" onclick="doLogin()">Prihlásiť sa</button>
<button class="forgot-link" onclick="showReset()">Zabudol som heslo</button>
<button class="btn-primary" onclick="doLogin()">Prihlásiť sa</button>
<div class="err" id="l-err"></div>
</div>
@@ -543,8 +543,19 @@ async function doLogin() {
method:'POST', headers:{'Content-Type':'application/json'},
body: JSON.stringify({ email: v('l-email'), password: v('l-pass') })
});
if (res.ok) { const d = await res.json(); saveAuth(d); showApp(); }
else err.textContent = await res.text();
if (res.ok) {
const d = await res.json();
saveAuth(d);
// Reset všetkých auth inputov
['l-email','l-pass','r-email','r-newpass','r-newpass2','r-code'].forEach(id => {
const el = document.getElementById(id);
if (el) el.value = '';
});
document.getElementById('l-err').textContent = '';
document.getElementById('r-err').textContent = '';
showLogin();
showApp();
} else err.textContent = await res.text();
}
// Zaslanie kódu — aktivuje sa keď bude mailová služba funkčná