Добавить статистику и очистку аудита; доработать UI расшифровки.

- Страница /admin/stats: MinIO, pending/consumed, загрузки, audit-метрики
- Кнопка «Очистить» в аудите с подтверждением
- Красивые callout’ы и ошибки пароля; пустой пароль не тратит попытку
- Убрать автоопределение языка; «Расшифруй» в RU UI
This commit is contained in:
2026-07-18 23:50:44 +03:00
parent 8c8dbd2348
commit a881570938
17 changed files with 1007 additions and 258 deletions
+25 -1
View File
@@ -253,7 +253,31 @@ async def unwrap(
if wrap.has_password and wrap.password_hash:
max_attempts = max(1, int(settings.password_max_attempts or 3))
if not body.password or not verify_password(wrap.password_hash, body.password):
# Empty password: ask to enter it, do not burn an attempt.
if not (body.password or "").strip():
remaining = max(0, max_attempts - int(wrap.password_fail_count or 0))
await write_audit(
db,
event_type="wrap.unwrap",
success=False,
wrap_id=wrap_id,
**meta,
details={
"reason": "password_required",
"attempts_remaining": remaining,
"attempts_max": max_attempts,
},
)
raise HTTPException(
status_code=403,
detail={
"code": "password_required",
"attempts_remaining": remaining,
"attempts_max": max_attempts,
},
)
if not verify_password(wrap.password_hash, body.password):
wrap.password_fail_count = int(wrap.password_fail_count or 0) + 1
remaining = max(0, max_attempts - wrap.password_fail_count)
now_fail = datetime.now(timezone.utc)