Pull Request: Bug Fix - Clear Session on Browser Tab Close
Summary
This pull request addresses and fixes issue #29, where the clear_session() function was not being called when users closed the tab on their browser. The bug has been resolved by adding an AJAX call from the client side to trigger the clear_session() function in app.py.
Changes Made
Added a JavaScript script in the base.html to listen for the beforeunload event.
Integrated AJAX to make a GET request to /clear-session route in the Flask app.
Implemented the clear_session() function in app.py to clear user session data.
Testing
Tested on the local machine to ensure that the clear_session() function is triggered upon closing the browser tab.
Verified that the session is properly cleared, and user-specific data is removed as expected.
Fixes
Users now experience the intended behavior of session clearance when closing the browser tab.
Checklist
[x] Code is tested and works locally
[x] Commits are clear and messages are descriptive
Pull Request: Bug Fix - Clear Session on Browser Tab Close
Summary
This pull request addresses and fixes issue #29, where the
clear_session()
function was not being called when users closed the tab on their browser. The bug has been resolved by adding an AJAX call from the client side to trigger theclear_session()
function inapp.py
.Changes Made
base.html
to listen for thebeforeunload
event./clear-session
route in the Flask app.clear_session()
function inapp.py
to clear user session data.Testing
clear_session()
function is triggered upon closing the browser tab.Fixes
Checklist