Mercurial > public > sg101
comparison gpp/accounts/views.py @ 472:7c3816d76c6c
Implement rate limiting on registration and login for #224.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Thu, 25 Aug 2011 02:23:55 +0000 |
parents | 69d0306a6fe7 |
children | 886cc99e8406 |
comparison
equal
deleted
inserted
replaced
471:d83296cac940 | 472:7c3816d76c6c |
---|---|
11 from django.conf import settings | 11 from django.conf import settings |
12 | 12 |
13 from accounts.models import PendingUser | 13 from accounts.models import PendingUser |
14 from accounts.forms import RegisterForm | 14 from accounts.forms import RegisterForm |
15 from accounts import create_new_user | 15 from accounts import create_new_user |
16 from antispam.decorators import rate_limit | |
16 | 17 |
17 | 18 |
18 ####################################################################### | 19 ####################################################################### |
19 | 20 |
21 @rate_limit(count=10, interval=datetime.timedelta(minutes=1)) | |
20 def register(request): | 22 def register(request): |
21 if request.user.is_authenticated(): | 23 if request.user.is_authenticated(): |
22 return HttpResponseRedirect(settings.LOGIN_REDIRECT_URL) | 24 return HttpResponseRedirect(settings.LOGIN_REDIRECT_URL) |
23 | 25 |
24 if request.method == 'POST': | 26 if request.method == 'POST': |