admin fix
This commit is contained in:
@@ -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á
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
-- ============================================================
|
||||
-- CalendarReminder — vytvorenie admin používateľa
|
||||
-- Heslo: Admin@2025
|
||||
-- Spusti: mysql -h 192.168.1.68 -u mip -p"mip@2013" calendarreminder < create-admin.sql
|
||||
-- ============================================================
|
||||
|
||||
INSERT INTO Users (Username, Email, PasswordHash, CreatedAt)
|
||||
VALUES (
|
||||
'admin',
|
||||
'nas@culak.sk',
|
||||
'$2a$11$8yPi0lcuKsJH6/Ncvm2A6O4Nw9gZblkCZ23PxbibW5MVfG06syp5S',
|
||||
UTC_TIMESTAMP()
|
||||
)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
Email = VALUES(Email),
|
||||
PasswordHash = VALUES(PasswordHash);
|
||||
|
||||
-- Over výsledok
|
||||
SELECT id, Username, Email, CreatedAt FROM Users WHERE Username = 'admin';
|
||||
Reference in New Issue
Block a user