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
Install django-blockmodelbackend:
pip install django-blockmodelbackend
Add blockmodelbackend to your INSTALLED_APPS settings:
INSTALLED_APPS = [ ... 'blockmodelbackend', ]
Run the makemigrations and migrate commands:
python manage.py makemigrations blockmodelbackend 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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for django-blockmodelbackend-0.2.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a0f89b3507a30ad901b633613eb3d4f43dc4f1c1c7a8049c267a264d9bdaa6d4 |
|
MD5 | 15d444057e774e1b4426827a11136b19 |
|
BLAKE2b-256 | bb8f91811f908610c8cfd3c6508b5d92356861ce11452cd8ff53401ebc1bd570 |
Hashes for django_blockmodelbackend-0.2.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1434cd64c49115c8425110fc7d33cbbb0a763a2085bfaf6ebafc700922a7dcb9 |
|
MD5 | c4472c2cc9a257f465fd73ee26d34fcd |
|
BLAKE2b-256 | 981d4289c879887cb35c6e524c5e757301f7cede510ae8387fc0132f7d578f90 |