I am trying to get a login form I have in django to only allow three login attempts before redirecting to a "login help" page. I am currently using the builtin "django.contrib.auth.views.login" view with a custom template. How do I force it to redirect to another page after n failed login attempts?
There's actually a project out there which provides a Django middleware to do just this, called django-axes
. Simply install it with the instructions provided and then set AXES_LOGIN_FAILURE_LIMIT
to the number of login attempts you want before a record is created for the failed logins. You'll still have to check this record when you want to lock someone out, however.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With