From 22edfa690e2082b96e8839a0ec9025abb1d17db9 Mon Sep 17 00:00:00 2001 From: Markbeep Date: Sat, 15 Mar 2025 01:19:23 +0100 Subject: [PATCH] simplify exp check --- app/internal/auth/authentication.py | 6 +++--- pyproject.toml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/internal/auth/authentication.py b/app/internal/auth/authentication.py index 73f57a4..f339081 100644 --- a/app/internal/auth/authentication.py +++ b/app/internal/auth/authentication.py @@ -1,3 +1,4 @@ +from math import inf import time from typing import Annotated, Optional @@ -154,9 +155,8 @@ class ABRAuth: request: Request, session: Session, ) -> User: - if exp := request.session.get("exp"): - if exp < time.time(): - raise RequiresLoginException() + if request.session.get("exp", inf) < time.time(): + raise RequiresLoginException() return await self._get_session_auth(request, session) async def _get_none_auth(self, session: Session) -> User: diff --git a/pyproject.toml b/pyproject.toml index ae01a25..99260ff 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,7 +9,7 @@ build-backend = "setuptools.build_meta" [tool.pyright] include = ["**/*.py"] -exclude = ["**/__pycache__", "**/.venv"] +exclude = ["**/__pycache__", "**/.venv", "**/.direnv"] ignore = [] typeCheckingMode = "strict"