More logging for the admin session

This commit is contained in:
Thomas Sileo 2022-11-20 10:02:28 +01:00
parent ef4608f348
commit fbc46e0517

View file

@ -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