diff --git a/app/database.py b/app/database.py index 0c9c99b..90c9818 100644 --- a/app/database.py +++ b/app/database.py @@ -11,12 +11,6 @@ class Database: database=app.config["DB_DATABASE"] ) - def delete_old_sessions(self): - cursor = self.db.cursor() - cursor.execute("DELETE FROM sessions WHERE expiry_date <= CURRENT_TIMESTAMP") - self.db.commit() - cursor.close() - def create_session(self, username, password): cursor = self.db.cursor() cursor.execute("SELECT user_id FROM utilisateurs WHERE username=%s AND password=%s", (username, password)) @@ -40,6 +34,7 @@ class Database: def check_connection(self, uuid): cursor = self.db.cursor() + cursor.execute("DELETE FROM sessions WHERE expiry_date <= CURRENT_TIMESTAMP") cursor.execute("SELECT session_id FROM sessions WHERE session_id=%s", (uuid,)) result = cursor.fetchall() cursor.close() diff --git a/app/views.py b/app/views.py index 9c8e6b4..f9a5108 100644 --- a/app/views.py +++ b/app/views.py @@ -8,7 +8,6 @@ from .database import Session def views(app, db): def est_connecte(): - db.delete_old_sessions() return session.get("uuid") is not None and db.check_connection(session.get("uuid")) def login_required(func):