Skip to content

Commit

Permalink
Merge branch 'release/2.22.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
jwalgran committed Apr 17, 2019
2 parents 86e2dee + 7b57c6e commit 4cd9498
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 35 deletions.
35 changes: 0 additions & 35 deletions circle.yml

This file was deleted.

14 changes: 14 additions & 0 deletions opentreemap/opentreemap/settings/default_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@
'django.contrib.contenttypes',
'django.contrib.sites',
'django.contrib.auth',
'captcha',
'treemap',
'geocode',
'api',
Expand Down Expand Up @@ -405,3 +406,16 @@
'webpack-stats.json')
}
}

# For django-recaptcha https://github.com/praekelt/django-recaptcha
# Setting NOCAPTCHA to True enables v2
NOCAPTCHA = True

if os.environ.get('RECAPTCHA_PUBLIC_KEY', '') != '':
# We use an if block here because django-recaptcha will only use a default
# test key if these settings are undefined.
RECAPTCHA_PUBLIC_KEY = os.environ.get('RECAPTCHA_PUBLIC_KEY', None)
RECAPTCHA_PRIVATE_KEY = os.environ.get('RECAPTCHA_PRIVATE_KEY', None)
USE_RECAPTCHA = True
else:
USE_RECAPTCHA = False
5 changes: 5 additions & 0 deletions opentreemap/registration_backend/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from django import forms
from django.core.exceptions import ValidationError
from django.conf import settings
from django.contrib.auth.forms import AuthenticationForm
from django.utils.translation import ugettext_lazy as _
from django.core.urlresolvers import reverse
Expand Down Expand Up @@ -63,6 +64,10 @@ class RegistrationForm(DefaultRegistrationForm):
label=_('I wish to receive occasional email '
'updates from the tree maps to which I contribute.'))

if settings.USE_RECAPTCHA:
from captcha.fields import ReCaptchaField
captcha = ReCaptchaField(label='Verification')

def __init__(self, *args, **kwargs):
super(RegistrationForm, self).__init__(*args, **kwargs)

Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ django-apptemplates==1.3
django-contrib-comments==1.8.0
django-js-reverse==0.7.3
django-queryset-csv==1.0.0 # https://github.com/azavea/django-queryset-csv/commits/master
django-recaptcha==1.4.0
django-redis==4.8.0
django-registration-redux==1.7
# django-statsd-mozilla==0.3.16 # TODO: enable when compatible with Django > 1.8 https://github.com/django-statsd/django-statsd/issues/97
Expand Down

0 comments on commit 4cd9498

Please sign in to comment.