Commit c15f51ae authored by Chris Reffett's avatar Chris Reffett

Add captcha support for signups, this requires checking changes to

settings.py, installing new pip modules, and migrating the captcha db.
parent 25b723e9
......@@ -2,6 +2,7 @@ from django import forms
from go.models import URL
from django.core.validators import MinLengthValidator, MinValueValidator, RegexValidator
from django.core.exceptions import ValidationError
from captcha.fields import CaptchaField
class URLForm( forms.ModelForm ):
......@@ -85,3 +86,4 @@ class SignupForm( forms.Form ):
widget = forms.Textarea(attrs={
}),
)
captcha = CaptchaField()
......@@ -54,6 +54,17 @@ if you are interested.
{{ form.description }}
<br/><br/>
<label for="{{ form.captcha.id_for_label }}">{{ form.captcha.label }}</label>
<br/>
{% for error in form.captcha.errors %}
<p class="error">{{error}}</p>
{% empty %}
<br/>
{% endfor %}
{{ form.captcha }}
<br/><br/>
<input type="submit" value="Sign Up" />
<br/><br/>
......
......@@ -195,7 +195,6 @@ def signup(request):
full_name = form.cleaned_data.get('full_name')
description = form.cleaned_data.get('description')
send_mail('Signup from %s' % (username), '%s signed up at %s\n'
'Username: %s\nMessage: %s\nPlease attend to this request at '
'your earliest convenience.' % (str(full_name),
......
......@@ -82,6 +82,9 @@ INSTALLED_APPS = (
'piwik',
'django.contrib.admin',
'qrcode',
'captcha',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
)
SESSION_SERIALIZER = 'django.contrib.sessions.serializers.JSONSerializer'
......
......@@ -46,3 +46,8 @@ urlpatterns += patterns('go.views',
# Redirection regex.
url(r'^(?P<short>\w+)$', 'redirection', name = 'redirection'),
)
# Captcha support
urlpatterns += patterns('',
url(r'^captcha/', include('captcha.urls')),
)
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