Django has authentication module, which works great. There is little problem that once user is loged in, that information is saved for longer period of time. Even user close browser session do not end. Actually, I want that session to end when user close browser.
Is there any way that user's login information is no longer remember once browser is closed
Krish
Browsers deletes the session cookies when the browser is closed, if you close it normally and not only kills the process, so the session is permanently lost on the client side when the browser is closed.
By default, a session lasts until there's 30 minutes of inactivity, but you can adjust this limit so a session lasts from a few seconds to several hours.
In computing, a login session is the period of activity between a user logging in and logging out of a (multi-user) system.
Use this in settings.py:
SESSION_EXPIRE_AT_BROWSER_CLOSE = True
alternatively you can pass 0 in
set_expiry(0)
just like this:
request.session.set_expiry(0)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With