comparison antispam/__init__.py @ 690:988782c6ce6c

For #48, rework blocking code to use fail2ban.
author Brian Neal <bgneal@gmail.com>
date Sun, 01 Sep 2013 00:15:42 -0500
parents ee87ea74d46b
children 886234943aed
comparison
equal deleted inserted replaced
689:a8dc08cc5db4 690:988782c6ce6c
1 import datetime
2
3 from django.contrib.auth import views as auth_views 1 from django.contrib.auth import views as auth_views
4 2
5 from antispam.decorators import rate_limit 3 from antispam.decorators import log_auth_failures
4 import antispam.receivers
6 5
7 SPAM_PHRASE_KEY = "antispam.spam_phrases" 6 SPAM_PHRASE_KEY = "antispam.spam_phrases"
8 BUSTED_MESSAGE = ("Your post has tripped our spam filter. Your account has " 7 BUSTED_MESSAGE = ("Your post has tripped our spam filter. Your account has "
9 "been suspended pending a review of your post. If this was a mistake " 8 "been suspended pending a review of your post. If this was a mistake "
10 "then we apologize; your account will be restored shortly.") 9 "then we apologize; your account will be restored shortly.")
11 10
12 # Install rate limiting on auth login 11 # Install rate limiting on auth login
13 auth_views.login = rate_limit(lockout=datetime.timedelta(minutes=2))(auth_views.login) 12 auth_views.login = log_auth_failures('Login')(auth_views.login)