Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I limit the amount of login retries in Django

Tags:

python

django

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?

like image 882
RED MONKEY Avatar asked Jun 10 '10 02:06

RED MONKEY


1 Answers

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.

like image 126
Daniel DiPaolo Avatar answered Sep 29 '22 21:09

Daniel DiPaolo