{"repo":"bugov/django-auto-logout","free":true,"listed":false,"github":"https://github.com/bugov/django-auto-logout","clone":"git clone https://github.com/bugov/django-auto-logout.git","description":"✋ Auto logout a user after specific time in Django","language":"Python","stars":36,"topics":["django","python","logout","authentication","user","user-management"],"license":"MIT","category":"auth-billing-email","readme_excerpt":"django-auto-logout Auto logout a user after specific time in Django. Works with - Python🐍 ≥ 3.7, - Django🌐 ≥ 3.0. Documentation - How to install - User logout in case of: - downtime - session duration limitation - Auto-reload the browser page when the time runs out - Add a message to inform the user about logging out ✔️ Installation Append to settings.py middlewares: --- NOTE Make sure that the following middlewares are used before doing this: - django.contrib.sessions.middleware.SessionMiddleware - django.contrib.auth.middleware.AuthenticationMiddleware - django.contrib.messages.middleware.MessageMiddleware --- 💤 Logout in case of idle Logout a user if there are no requests for a long time. Add to settings.py : or the same, but with datetime.timedelta (more semantically): The user will log out the next time the page is requested. See REDIRECT TO LOGIN IMMEDIATELY to log out right after the idle-time has expired (and redirect to login page). 🔄 REDIRECT TO LOGIN IMMEDIATELY after the idle-time has expired Use the REDIRECT TO LOGIN IMMEDIATELY option if you want to redirect the user to the login page immediately after the idle-time expires: This requires a client-side script, so you should modify your context processors in settings.py : And add this to your templates (will add a redirect script to your html): If you want to use this in your JavaScript code, following template variables may be useful: REDIRECT TO LOGIN IMMEDIATELY works with SESSION TIME too. ⌛ Limit session","default_branch":null,"files":null,"tree":[],"storefront":"/r/bugov","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/bugov/django-auto-logout/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}