Custom model backend for blocking users and ip after several attempts to access wrongly
Installation
Install django-blockmodelbackend:
pip install django-blockmodelbackend
Add blockmodelbackend to your INSTALLED_APPS settings:
INSTALLED_APPS = [ ... 'blockmodelbackend', ]Run migrate command:
python manage.py migrate
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)
| File | Size | Uploaded | |
|---|---|---|---|
| django-blockmodelbackend-0.3.0.tar.gz | 4.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| 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
|