Skip to main content

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

Release files for django-blockmodelbackend 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-blockmodelbackend 0.3.0
File Size Uploaded
django-blockmodelbackend-0.3.0.tar.gz 4.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-blockmodelbackend 0.3.0
File Interpreter ABI Platform
django_blockmodelbackend-0.3.0-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 10.8 kB

Release files / django-blockmodelbackend-0.3.0.tar.gz

Download URL django-blockmodelbackend-0.3.0.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
49314d5e86bc62b51cd890560c7dc5216f522d7c3fa7482b16f546fff01eacdc
BLAKE2b-256 checksum
How to use checksums
c3b09cf691be49fc9a550e40613c612bf718875e6b5ca6b27611da5d4468cd7e
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / django_blockmodelbackend-0.3.0-py2.py3-none-any.whl

Download URL django_blockmodelbackend-0.3.0-py2.py3-none-any.whl
Size 6.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
f0523dadf86b6abe6d0b9847afd6c3d75a96a775e58170d1089949fe840ddec0
BLAKE2b-256 checksum
How to use checksums
69272c264942ab75e2988e081e6b2682589f8fc3450aac6901a6bea00934a228
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.2

2 release files

0.2.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page