From 6026f21a60f1b2563bef2df817efed5abe6b7992 Mon Sep 17 00:00:00 2001 From: s3lph Date: Wed, 5 Feb 2020 00:34:22 +0100 Subject: [PATCH] Fix: Session timeout lead to 500 error --- CHANGELOG.md | 15 ++++++++++++++- matemat/__init__.py | 2 +- matemat/webserver/session/sessions.py | 3 ++- package/archlinux/PKGBUILD | 2 +- package/debian/matemat/DEBIAN/control | 2 +- 5 files changed, 19 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 53a9c59..3569157 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,20 @@ # Matemat Changelog + +## Version 0.2.3 + +Bugfix fix release + +### Changes + + +- Fix: Session timeout lead to 500 error + + + + -## Version 0.2.1 +## Version 0.2.2 Security fix release diff --git a/matemat/__init__.py b/matemat/__init__.py index 954cb1c..12dad7e 100644 --- a/matemat/__init__.py +++ b/matemat/__init__.py @@ -1,2 +1,2 @@ -__version__ = '0.2.2' +__version__ = '0.2.3' diff --git a/matemat/webserver/session/sessions.py b/matemat/webserver/session/sessions.py index 6b5aad3..a3d3672 100644 --- a/matemat/webserver/session/sessions.py +++ b/matemat/webserver/session/sessions.py @@ -33,7 +33,8 @@ def start() -> str: # Check for session timeout if session_id in __session_vars and __session_vars[session_id][0] < now: end(session_id) - raise TimeoutError('Session timed out.') + # Create new session ID after terminating the previous session + session_id = str(uuid4()) # Update or initialize the session timeout if session_id not in __session_vars: __session_vars[session_id] = (now + timedelta(seconds=_SESSION_TIMEOUT)), dict() diff --git a/package/archlinux/PKGBUILD b/package/archlinux/PKGBUILD index 18e7dc5..68994c7 100644 --- a/package/archlinux/PKGBUILD +++ b/package/archlinux/PKGBUILD @@ -2,7 +2,7 @@ # Maintainer: s3lph pkgname=matemat -pkgver=0.2.2 +pkgver=0.2.3 pkgrel=1 arch=('any') diff --git a/package/debian/matemat/DEBIAN/control b/package/debian/matemat/DEBIAN/control index eb52b4c..ad4b86d 100644 --- a/package/debian/matemat/DEBIAN/control +++ b/package/debian/matemat/DEBIAN/control @@ -1,5 +1,5 @@ Package: matemat -Version: 0.2.2 +Version: 0.2.3 Maintainer: s3lph Section: web Priority: optional