Permalink
Browse files

Add captcha to registration

  • Loading branch information...
1 parent 81851da commit 3b13c05ac0f1c7d533200e676b037597ebd9d887 @zeus zeus committed Apr 25, 2012
Showing with 23 additions and 6 deletions.
  1. +2 −1 build/pipreq.txt
  2. +5 −4 fabfile.py
  3. +6 −0 forms.py
  4. +3 −1 settings.py
  5. +7 −0 urls.py
View
@@ -1,2 +1,3 @@
-e git+https://github.com/hovel/pybbm.git#egg=pybbm
-django-registration
+django-registration
+django-simple-captcha
View
@@ -6,8 +6,8 @@
from fabric.api import *
-PROJECT_NAME = 'pybbm'
-PROJECT_PROCESS = 'pybbm_org'
+PROJECT_NAME = 'pybbm_org'
+PROJECT_PROCESS = 'pybbm'
PROJECT_BASEDIR = '/home/zeus/webapps/%s' % PROJECT_PROCESS
PROJECT_ROOT = '/home/zeus/webapps/%s/%s'% (PROJECT_PROCESS, PROJECT_NAME)
@@ -25,8 +25,9 @@ def install():
def fu():
local('./manage.py test pybb')
with cd(PROJECT_ROOT):
- run('git pull')
- run('pip -E ../env install -e git+https://github.com/hovel/pybbm.git#egg=pybbm --upgrade --no-deps')
+ run('git fetch')
+ run('git checkout origin/master')
+ run('pip -E ../env install pybbm --upgrade --no-deps')
run('../env/bin/python manage.py syncdb')
run('../env/bin/python manage.py migrate')
run('../env/bin/python manage.py collectstatic --noinput')
View
@@ -0,0 +1,6 @@
+from registration.forms import RegistrationFormUniqueEmail
+from captcha.fields import CaptchaField
+
+class RegistrationFormCaptcha(RegistrationFormUniqueEmail):
+
+ captcha = CaptchaField(label=u'I am human')
View
@@ -76,13 +76,15 @@
'sorl.thumbnail',
'south',
'pure_pagination',
-
+ 'captcha'
)
STATICFILES_DIRS = (
os.path.join(PROJECT_ROOT, 'static'),
)
+USE_TZ = True
+
TEMPLATE_CONTEXT_PROCESSORS = (
'django.contrib.auth.context_processors.auth',
'django.core.context_processors.debug',
View
@@ -2,11 +2,18 @@
from django.conf.urls.static import static
from django.conf import settings
from django.contrib import admin
+from forms import RegistrationFormCaptcha
+from registration.views import register
admin.autodiscover()
urlpatterns = patterns('',
url(r'^admin/', include(admin.site.urls)),
(r'^', include('pybb.urls', namespace='pybb')),
+ url(r'^accounts/register/$',
+ register,
+ kwargs={'form_class': RegistrationFormCaptcha},
+ name='registration_register'),
(r'^accounts/', include('registration.urls')),
+ (r'^captcha/', include('captcha.urls')),
) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

0 comments on commit 3b13c05

Please sign in to comment.