User login session ends with browser closure

Django has an authentication module that works great. There is a small problem associated with the fact that after the user logs in to the system, this information is stored for a longer period of time. Even closing a user session does not end. In fact, I want this session to end when the user closes the browser.

Is there a way in which user login information is no longer remembered after closing the browser.

Krish

+4
source share
2 answers

Use this in settings.py:

SESSION_EXPIRE_AT_BROWSER_CLOSE = True 
+10
source

alternatively you can pass 0 to

set_expiry (0)

just:

request.session.set_expiry (0)

+1
source

All Articles