Files
WFL/README_AUTH.md

46 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# WFL auth + idle session timeout
Этот набор добавляет:
- страницу `/login`
- `HttpOnly` cookie `auth_token`
- серверную проверку всех `/admin/*`
- автоматический logout после 2 часов бездействия
- rolling session timeout
- logout кнопку
- обработку `401` для AJAX/fetch
## Что заменить в проекте
Скопируй файлы в свой проект:
- `app.py` -> заменить текущий
- `repositories/auth_repository.py` -> новый файл
- `services/auth_service.py` -> новый файл
- `templates/login.html` -> новый файл
- `templates/matches.html` -> заменить
- `templates/match_workspace.html` -> заменить
## SQL
Выполни файл:
- `sql/001_auth.sql`
## Первый админ
1. Запусти:
`python scripts/create_admin.py`
2. Скопируй выведенный SQL
3. Выполни его в PostgreSQL
## Важно
В `app.py` cookie сейчас создаётся так:
- `secure=False`
Для production под HTTPS поменяй на:
- `secure=True`
## Что не трогалось
Твои `match_sessions` оставлены как рабочие сессии матча.
Пользовательская авторизация вынесена отдельно в `admin_users` и `auth_sessions`.