Add honeypot field to login form: instant 24h IP ban on autofill

This commit is contained in:
dev
2026-09-12 00:40:29 +03:00
parent 2c7ec17c8b
commit d5359dd31f
3 changed files with 6 additions and 1 deletions
+1 -1
View File
@@ -10,7 +10,7 @@ async function doLogin() {
const res = await fetch(`${API}/api/auth/login`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ username, password }),
body: JSON.stringify({ username, password, website: document.getElementById('hpWebsite').value }),
});
const data = await res.json().catch(() => ({}));
if (res.ok && data.token) {
+1
View File
@@ -25,6 +25,7 @@ body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;b
<h1>Админ-панель</h1>
<input type="text" id="userInput" placeholder="Логин" autocomplete="username" autofocus>
<input type="password" id="pwdInput" placeholder="Пароль" autocomplete="current-password">
<input type="text" id="hpWebsite" tabindex="-1" autocomplete="off" style="display:none" value="">
<button type="button" id="loginBtn">Войти</button>
<div class="err" id="loginErr">Неверный логин или пароль</div>
<div class="back"><a href="/">На главную</a></div>