feat: управление пользователями в админке

- Заблокировать/разблокировать (blocked поле + проверка при логине)
- Удалить (с confirm, нельзя удалить себя)
- Изменить роль (admin ↔ user)
- Ручная верификация email
- Миграция: ALTER TABLE users ADD blocked
- UI: кнопки действий с цветными статусами

Тест: register → verify → block(401) → unblock(200) → delete ✅

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
anor
2026-03-27 16:15:07 +10:00
co-authored by Claude Opus 4.6
parent ee3d3e8c24
commit 288cbe17c5
4 changed files with 119 additions and 17 deletions
+1 -1
View File
@@ -90,7 +90,7 @@ def authenticate(username: str, password: str, client_ip: str = "") -> str | Non
# 2. Registered users from SQLite
from db import get_user_by_email
user = get_user_by_email(username) # username = email
if user and user["verified"] and check_password(password, user["password_hash"]):
if user and user["verified"] and not user.get("blocked") and check_password(password, user["password_hash"]):
return _make_token(user["email"], role=user["role"])
if client_ip: