Skip to main content

Django middleware that prevents multiple concurrent logins.

Project description

Django middleware that prevents multiple concurrent logins. If a user is already logged into the Django application and tries to log in somewhere else, the previous session is deleted.

This package is based on code from http://stackoverflow.com/a/1814797 and https://gist.github.com/peterdemin/5829440.

Usage

  1. Add “preventconcurrentlogins” to your INSTALLED_APPS settings like this:

    ```python
        INSTALLED_APPS = {
            ...
                'preventconcurrentlogins',
        }
    ```
  2. Add “preventconcurrentlogins.middleware.PreventConcurrentLoginsMiddleware” to MIDDLEWARE_CLASSES:

    ```python
        MIDDLEWARE_CLASSES = {
            ...
                'preventconcurrentlogins.middleware.PreventConcurrentLoginsMiddleware',
        }
    ```

3. Run python manage.py migrate to create the visitor model that is used to track a users currently active session key.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-preventconcurrentlogins-0.8.2.tar.gz (4.3 kB view details)

Uploaded Source

File details

Details for the file django-preventconcurrentlogins-0.8.2.tar.gz.

File metadata

File hashes

Hashes for django-preventconcurrentlogins-0.8.2.tar.gz
Algorithm Hash digest
SHA256 9cb45fcd63edeec55e5ac29bbd2ee96974dc2a72d74ab88088dbf6a1f52978e9
MD5 b8dd55296ae07819c18967505405104d
BLAKE2b-256 bc90ed3b82373bb8150f22e53cf45329f302b440a28bf0773b7bd76681106e0d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page