Skip to main content

Custom model backend for blocking users and ip after several attempts to access wrongly

Project description

Custom model backend for blocking users and ip after several attempts to access wrongly

Installation

  1. Install django-blockmodelbackend:

    pip install django-blockmodelbackend
  2. Add blockmodelbackend to your INSTALLED_APPS settings:

    INSTALLED_APPS = [
            ...
            'blockmodelbackend',
    ]
  3. Run migrate command:

    python manage.py migrate
  4. Add the new backend class to your AUTHENTICATION_BACKENDS settings:

    AUTHENTICATION_BACKENDS = [
            ...
            'blockmodelbackend.modelbackend.BlockModelBackend',
    ]

Configuration

There is some parameters to customize the backend.

. MAX_ACCESS_ATTEMPTS:[ 3 ] maximum numbers of wrong authentication attempts before blocking

. LOCK_DURATION:[ 5 ] lock duration in minutes

. DELTA_LOCK_DURATION:[ 1 ] increase in the lock duration in minutes

. USER_PERMANENT_BLOCK:[ False ] boolean value

. IP_PERMANENT_BLOCK:[ False ] boolean value

. BLOCK_TYPE:[ both ] choice between both, user or ip

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-blockmodelbackend-0.3.0.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_blockmodelbackend-0.3.0-py2.py3-none-any.whl (6.1 kB view details)

Uploaded Python 2Python 3

File details

Details for the file django-blockmodelbackend-0.3.0.tar.gz.

File metadata

  • Download URL: django-blockmodelbackend-0.3.0.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.8

File hashes

Hashes for django-blockmodelbackend-0.3.0.tar.gz
Algorithm Hash digest
SHA256 49314d5e86bc62b51cd890560c7dc5216f522d7c3fa7482b16f546fff01eacdc
MD5 4f794d77ae1a8b41e49f8eb1694cc4ec
BLAKE2b-256 c3b09cf691be49fc9a550e40613c612bf718875e6b5ca6b27611da5d4468cd7e

See more details on using hashes here.

File details

Details for the file django_blockmodelbackend-0.3.0-py2.py3-none-any.whl.

File metadata

  • Download URL: django_blockmodelbackend-0.3.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.8

File hashes

Hashes for django_blockmodelbackend-0.3.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 f0523dadf86b6abe6d0b9847afd6c3d75a96a775e58170d1089949fe840ddec0
MD5 278ee7d78125ff9ee4ad18f6dd3acd3f
BLAKE2b-256 69272c264942ab75e2988e081e6b2682589f8fc3450aac6901a6bea00934a228

See more details on using hashes here.

Supported by

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