forked from forks/microblog.pub
More logging for the admin session
This commit is contained in:
parent
ef4608f348
commit
fbc46e0517
1 changed files with 3 additions and 0 deletions
|
@ -61,14 +61,17 @@ async def user_session_or_redirect(
|
||||||
)
|
)
|
||||||
|
|
||||||
if not session:
|
if not session:
|
||||||
|
logger.info("No existing admin session")
|
||||||
raise _RedirectToLoginPage
|
raise _RedirectToLoginPage
|
||||||
|
|
||||||
try:
|
try:
|
||||||
loaded_session = session_serializer.loads(session, max_age=3600 * 24 * 3)
|
loaded_session = session_serializer.loads(session, max_age=3600 * 24 * 3)
|
||||||
except Exception:
|
except Exception:
|
||||||
|
logger.exception("Failed to validate admin session")
|
||||||
raise _RedirectToLoginPage
|
raise _RedirectToLoginPage
|
||||||
|
|
||||||
if not loaded_session.get("is_logged_in"):
|
if not loaded_session.get("is_logged_in"):
|
||||||
|
logger.info(f"Admin session invalidated: {loaded_session}")
|
||||||
raise _RedirectToLoginPage
|
raise _RedirectToLoginPage
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
Loading…
Reference in a new issue