diff options
-rw-r--r-- | account/forms.py | 6 | ||||
-rw-r--r-- | django_skaschool/settings.py | 6 | ||||
-rw-r--r-- | requirements.txt | 1 |
3 files changed, 12 insertions, 1 deletions
diff --git a/account/forms.py b/account/forms.py index f5f515f..c7e15d3 100644 --- a/account/forms.py +++ b/account/forms.py @@ -7,9 +7,11 @@ account/forms.py for skaschool from django import forms from django.contrib.auth.models import User from django.contrib.sites.models import Site, RequestSite -from registration.forms import RegistrationFormUniqueEmail from django.utils.translation import ugettext_lazy as _ +from registration.forms import RegistrationFormUniqueEmail +from captcha.fields import ReCaptchaField + from account.models import UserProfile @@ -25,6 +27,8 @@ class UserRegForm(RegistrationFormUniqueEmail): gender = forms.ChoiceField(choices=GENDERS, label=_("Gender")) institute = forms.CharField(max_length=100, label=_("Institute")) identify = forms.ChoiceField(choices=IDENTIFIES, label=_("Identify")) + captcha = ReCaptchaField(label=_("Captcha"), + attrs={'theme': 'clean'}) #def __init__(self, *args, **kw): # super(UserRegForm, self).__init__(*args, **kw) diff --git a/django_skaschool/settings.py b/django_skaschool/settings.py index 7bb21b3..f80c964 100644 --- a/django_skaschool/settings.py +++ b/django_skaschool/settings.py @@ -44,6 +44,7 @@ THIRD_PARTY_APPS = ( #'south', 'bootstrap3', 'registration', + 'captcha', ) # LOCAL_APPS LOCAL_APPS = ( @@ -166,4 +167,9 @@ ACCOUNT_ACTIVATION_DAYS = 7 # whether registration of new accounts if currently permitted REGISTRATION_OPEN = True +## django-recaptcha +# global key (recaptcha.net) +RECAPTCHA_PUBLIC_KEY = '6Lf8dvISAAAAAPljExJQcAkx4jDZPOYbTGXYXCME' +RECAPTCHA_PRIVATE_KEY = '6Lf8dvISAAAAAH75mmLlVWOp6JB9Gx6WARR_6HXb' + # vim: set ts=4 sw=4 tw=0 fenc=utf-8 ft=python: diff --git a/requirements.txt b/requirements.txt index f15cb71..f5fb4b4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,5 +2,6 @@ Django==1.6.2 MySQL-python==1.2.5 South==0.8.4 django-bootstrap3==4.2.0 +django-recaptcha==1.0 django-registration==1.0 wsgiref==0.1.2 |