From aa4d157c306e437445384abc08bac51fa1262e7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20G=C3=B3mez=20Garc=C3=ADa?= Date: Tue, 12 Apr 2022 21:36:17 +0200 Subject: [PATCH] Fixed request session timeout --- server/src/uds/core/util/middleware/request.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/server/src/uds/core/util/middleware/request.py b/server/src/uds/core/util/middleware/request.py index b479edd10..44a84cc3e 100644 --- a/server/src/uds/core/util/middleware/request.py +++ b/server/src/uds/core/util/middleware/request.py @@ -35,6 +35,7 @@ import typing from django.http import HttpRequest, HttpResponse from django.utils import timezone +from sympy import EX from uds.core.util import os_detector as OsDetector from uds.core.util.config import GlobalConfig @@ -89,9 +90,12 @@ class GlobalRequestMiddleware: now = timezone.now() expiry = request.session.get(EXPIRY_KEY, now) if expiry < now: - webLogout( - request=request - ) # Ignore the response, just processes usere session logout + try: + webLogout( + request=request + ) # Ignore the response, just processes usere session logout + except Exception: + pass return HttpResponse(content='Session Expired', status=403) # Update session timeout..self. request.session[EXPIRY_KEY] = now + datetime.timedelta(