Created a new model to represent the Flask-Session storage schema sessions with a method for removing expired sessions.

Added a trigger for the Flask-Session model's session clean-up method to the `before_request` handler of the user router.
This commit is contained in:
Matt Scott
2023-11-24 06:26:38 -05:00
parent 45f1ba7b82
commit 4442577b0b
2 changed files with 44 additions and 0 deletions

View File

@@ -37,6 +37,11 @@ def before_request():
minutes=int(Setting().get('session_timeout')))
session.modified = True
# Clean up expired sessions in the database
if Setting().get('session_type') == 'sqlalchemy':
from ..models.sessions import Sessions
Sessions().clean_up_expired_sessions()
@user_bp.route('/profile', methods=['GET', 'POST'])
@login_required