testing-fix
Some checks failed
Deploy on push / deploy (push) Failing after 4m52s

This commit is contained in:
2025-09-01 00:13:46 +03:00
parent 68231b664e
commit 62529959a9
7 changed files with 34 additions and 35 deletions

View File

@@ -81,20 +81,20 @@ class Author(Base):
"""Проверяет пароль пользователя"""
return Password.verify(password, str(self.password)) if self.password else False
def set_password(self, password: str):
def set_password(self, password: str) -> None:
"""Устанавливает пароль пользователя"""
self.password = Password.encode(password) # type: ignore[assignment]
self.password = Password.encode(password)
def increment_failed_login(self):
def increment_failed_login(self) -> None:
"""Увеличивает счетчик неудачных попыток входа"""
self.failed_login_attempts += 1 # type: ignore[assignment]
self.failed_login_attempts += 1
if self.failed_login_attempts >= 5:
self.account_locked_until = int(time.time()) + 300 # type: ignore[assignment] # 5 минут
self.account_locked_until = int(time.time()) + 300 # 5 минут
def reset_failed_login(self):
def reset_failed_login(self) -> None:
"""Сбрасывает счетчик неудачных попыток входа"""
self.failed_login_attempts = 0 # type: ignore[assignment]
self.account_locked_until = None # type: ignore[assignment]
self.failed_login_attempts = 0
self.account_locked_until = None
def is_locked(self) -> bool:
"""Проверяет, заблокирован ли аккаунт"""
@@ -150,7 +150,7 @@ class Author(Base):
authors = session.query(cls).where(cls.oauth.isnot(None)).all()
for author in authors:
if author.oauth and provider in author.oauth:
oauth_data = author.oauth[provider] # type: ignore[index]
oauth_data = author.oauth[provider]
if isinstance(oauth_data, dict) and oauth_data.get("id") == provider_id:
return author
return None
@@ -165,13 +165,13 @@ class Author(Base):
email (Optional[str]): Email от провайдера
"""
if not self.oauth:
self.oauth = {} # type: ignore[assignment]
self.oauth = {}
oauth_data: Dict[str, str] = {"id": provider_id}
if email:
oauth_data["email"] = email
self.oauth[provider] = oauth_data # type: ignore[index]
self.oauth[provider] = oauth_data
def get_oauth_account(self, provider: str) -> Dict[str, Any] | None:
"""