Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Protect the registration form with reCaptcha

Roland Geider397c776a06d6
diff --git a/manager/forms.py b/manager/forms.py
index 6616ac9c2..e2791cc26 100644
--- a/manager/forms.py
+++ b/manager/forms.py
@@ -31,6 +31,8 @@ from django.contrib.auth.models import User as Django_User
from django.utils.translation import ugettext as _
+from captcha.fields import ReCaptchaField
+
from manager.models import UserProfile
from manager.models import TrainingSchedule
from manager.models import Day
@@ -67,7 +69,9 @@ class UserEmailForm(ModelForm):
class RegistrationForm(UserCreationForm, UserEmailForm):
- pass
+ captcha = ReCaptchaField(attrs={'theme': 'clean'},
+ label=_('Confirmation text'),
+ help_text=_('As a security measure, please enter the previous words'),)
class WorkoutForm(ModelForm):
diff --git a/workout_manager/settings.sample.py b/workout_manager/settings.sample.py
index 46b07ab10..2ba52fc74 100644
--- a/workout_manager/settings.sample.py
+++ b/workout_manager/settings.sample.py
@@ -44,7 +44,7 @@ TEMPLATE_CONTEXT_PROCESSORS = (
# timezone as the operating system.
# If running in a Windows environment this must be set to the same as your
# system time zone.
-TIME_ZONE = None
+TIME_ZONE = None
# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
@@ -146,8 +146,14 @@ INSTALLED_APPS = (
'weight',
'exercises',
'nutrition',
+
+ # reCaptcha support, see https://github.com/praekelt/django-recaptcha
+ 'captcha',
)
+RECAPTCHA_PUBLIC_KEY = ''
+RECAPTCHA_PRIVATE_KEY = ''
+
AUTHENTICATION_BACKENDS = (
'django.contrib.auth.backends.ModelBackend',
'django_browserid.auth.BrowserIDBackend',