Files
core/auth/state.py
Untone e78e12eeee
Some checks failed
Deploy on push / deploy (push) Failing after 17s
circular-fix
2025-08-17 16:33:54 +03:00

25 lines
793 B
Python
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.
"""
Классы состояния авторизации
"""
class AuthState:
"""
Класс для хранения информации о состоянии авторизации пользователя.
Используется в аутентификационных middleware и функциях.
"""
def __init__(self) -> None:
self.logged_in: bool = False
self.author_id: str | None = None
self.token: str | None = None
self.username: str | None = None
self.is_admin: bool = False
self.is_editor: bool = False
self.error: str | None = None
def __bool__(self) -> bool:
"""Возвращает True если пользователь авторизован"""
return self.logged_in