{"repo":"hapytex/django-single-session","free":true,"listed":false,"github":"https://github.com/hapytex/django-single-session","clone":"git clone https://github.com/hapytex/django-single-session.git","description":"Allow a user to only have a single active session in Django.","language":"Python","stars":21,"topics":["authentication","django","python","session"],"license":"BSD-3-Clause","category":"auth-billing-email","readme_excerpt":"Django-single-session A Django app that enforces that a user has only one active session: if the user logs in on another browser/device, then the previous sessions will log out. The app will also add an extra action to the ModelAdmin of the user model (if there is such ModelAdmin ), that will alow to log out all sessions of a given (set of) user(s). Installation The package can be fetched as django-single-session , so for example with pip with: One can install the app by adding the single session app to the INSTALLED APPS setting: For the SESSION ENGINE setting, the database backend, django.contrib.sessions.backends.db should be used, since that is the one where the item is linking to. In order to work properly, the SessionMiddleware and AuthenticationMiddleware will be necessary, or another middleware class that will add a .session and .user attribute on the request object and will trigger the user logged in and user logged out signals with the proper session and user. and running migrate to migrate the database properly: This will by default enforce that a user will only have one logged in session. This will not proactively logout existing sessions: only if the user logs in with another browser or device, the old session(s) will be closed. Configuration One can disable the single session behavior by setting SINGLE USER SESSION in settings.py to False (or any other value with truthiness False ). You can customise this behaviour by making the SINGLE USER SESSION setting be a ","default_branch":null,"files":null,"tree":[],"storefront":"/r/hapytex","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/hapytex/django-single-session/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."}