From be58b3e61477d8007fbd033ab758d30eb652d55e Mon Sep 17 00:00:00 2001 From: Stephen Burrows Date: Mon, 13 Sep 2010 13:53:25 -0400 Subject: [PATCH 1/1] Added recaptcha support to waldo registration form. --- contrib/waldo/forms.py | 8 ++++++++ contrib/waldo/models.py | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/contrib/waldo/forms.py b/contrib/waldo/forms.py index 4465a99..18c22a4 100644 --- a/contrib/waldo/forms.py +++ b/contrib/waldo/forms.py @@ -1,5 +1,6 @@ from datetime import date from django import forms +from django.conf import settings from django.contrib.auth.forms import AuthenticationForm, UserCreationForm from django.contrib.auth.models import User from django.core.exceptions import ValidationError @@ -19,6 +20,13 @@ class EmailInput(forms.TextInput): class RegistrationForm(UserCreationForm): email = forms.EmailField(widget=EmailInput) + try: + from recaptcha_django import ReCaptchaField + except ImportError: + pass + else: + if 'recaptcha_django.middleware.ReCaptchaMiddleware' in settings.MIDDLEWARE_CLASSES: + recaptcha = ReCaptchaField() def clean_username(self): username = self.cleaned_data['username'] diff --git a/contrib/waldo/models.py b/contrib/waldo/models.py index 183fe49..83724f4 100644 --- a/contrib/waldo/models.py +++ b/contrib/waldo/models.py @@ -257,7 +257,7 @@ class LoginMultiView(MultiView): } self.send_confirmation_email('Confirm account creation at %s' % current_site.name, user.email, self.register_confirmation_email, context) messages.add_message(request, messages.SUCCESS, 'An email has been sent to %s with details on activating your account.' % user.email, fail_silently=True) - return HttpResponseRedirect('') + return HttpResponseRedirect(node.get_absolute_url()) else: form = RegistrationForm() -- 2.20.1