From 639baafe4ac424d1dbab1027550461be0c6f5866 Mon Sep 17 00:00:00 2001 From: roman Date: Wed, 10 Jun 2026 23:00:58 +0200 Subject: [PATCH] admin fix --- CalendarReminder.Api/wwwroot/index.html | 17 ++++++++++++++--- create-admin.sql | 19 +++++++++++++++++++ 2 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 create-admin.sql diff --git a/CalendarReminder.Api/wwwroot/index.html b/CalendarReminder.Api/wwwroot/index.html index 28d7757..f987fc1 100644 --- a/CalendarReminder.Api/wwwroot/index.html +++ b/CalendarReminder.Api/wwwroot/index.html @@ -363,8 +363,8 @@
- +
@@ -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á diff --git a/create-admin.sql b/create-admin.sql new file mode 100644 index 0000000..db952a0 --- /dev/null +++ b/create-admin.sql @@ -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';