Commit 3b60c22d authored by stef's avatar stef

[enh] added captcha

parent 110b4e5b
......@@ -4,6 +4,7 @@ from django.utils.translation import ugettext as _
from bt.models import Violation, COUNTRIES, RESOURCES, TYPES, MEDIA
from bt.multifile import MultiFileField
from operator import itemgetter
from captcha.fields import CaptchaField
class AdvancedEditor(forms.Textarea):
class Media:
......@@ -30,3 +31,4 @@ class AddViolation(forms.Form):
contractual = forms.BooleanField(required=False, help_text=_('Is the restriction described in the users contract?'))
contract_excerpt = forms.CharField(required=False, widget=AdvancedEditor(), help_text=_('Please copy the relevant section describing the restriction from the user contract.'))
loophole = forms.BooleanField(required=False, help_text=_('Is there another offer provided by this Operator which removes this restriction?'))
captcha = CaptchaField(help_text=_("Unfortunately we must protect against automatic attack, please forgive us this inconvenience."))
......@@ -6,3 +6,4 @@ django-simple-captcha>=0.2.0
django-tinymce>=1.5
pysqlite>=1.0.1
BabelDjango>=0.2.2
PIL>=1.1.7
......@@ -131,6 +131,7 @@ INSTALLED_APPS = (
'registration',
'bt',
'babeldjango',
'captcha',
# Uncomment the next line to enable the admin:
# 'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
......@@ -167,6 +168,9 @@ SESSION_ENGINE = 'django.contrib.sessions.backends.file'
ACCOUNT_ACTIVATION_DAYS = 7
LOGIN_REDIRECT_URL = '/'
CAPTCHA_NOISE_FUNCTIONS = ('captcha.helpers.noise_dots',)
CAPTCHA_CHALLENGE_FUNCT = 'captcha.helpers.math_challenge'
try:
from local_settings import *
except:
......
......@@ -10,6 +10,7 @@ urlpatterns = patterns('',
(r'^$', bt.index),
(r'^accounts/logout$', 'django.contrib.auth.views.logout', {'next_page' : '/'}),
(r'^accounts/', include('registration.urls')),
url(r'^captcha/', include('captcha.urls')),
(r'^ajax/(?P<country>[^/]*)(/(?P<operator>[^/]*))?$', bt.ajax),
(r'^add/$', bt.add),
)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment