I created a site with django. Users must be able to log in. The input view is as follows:
from django.contrib.auth import authenticate, login from django.contrib.auth.models import User .... if request.method == 'POST': username = request.POST['username']
But with this "decision" I can not cope with brute force. So I looked around and found this: Malicious activity using attacks in Django
The first answer was helpful. I chose django-axes because django-ratelimit only considers amout of a view call.
But here is my problem: when I try to log in with the wrong password, this is not considered a failure. (Only in the / admin section).
I did not find the option to "add" my input type in the django-axis.
So here is my question:
How to configure django axes to handle failed logins from my login window?
EDIT: Here is my settings file:
INSTALLED_APPS = ( 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'axes', ) MIDDLEWARE_CLASSES = ( 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'axes.middleware.FailedLoginMiddleware' ) ... AXES_LOCK_OUT_AT_FAILURE = False AXES_USE_USER_AGENT = True AXES_COOLOFF_TIME = 1 AXES_LOGIN_FAILURE_LIMIT = 50
source share