Skip to content

Commit

Permalink
Add reCAPTCHA to the contact form (#3571)
Browse files Browse the repository at this point in the history
* Add reCAPTCHA to the contact form

* Fix captcha error
  • Loading branch information
willgearty authored Nov 2, 2022
1 parent becea0b commit 2840974
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions esp/esp/django_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@
'argcache.apps.ArgCacheConfig',
'django_extensions',
'reversion',
'captcha',
'form_utils',
'django.contrib.redirects',
'debug_toolbar',
Expand Down Expand Up @@ -410,3 +411,5 @@ def custom_show_toolbar(request):
ADMIN_TOOLS_APP_INDEX_DASHBOARD = 'admintoolsdash.CustomAppIndexDashboard'

ADMIN_TOOLS_THEMING_CSS = '/media/default_styles/admin_theme.css'

SILENCED_SYSTEM_CHECKS = ['captcha.recaptcha_test_key_error']
4 changes: 3 additions & 1 deletion esp/esp/web/forms/contact_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@

from django.conf import settings

from captcha.fields import ReCaptchaField

person_type = (
('Student', 'K-12 Student'),
('Parent', 'Parent/Guardian'),
Expand Down Expand Up @@ -84,4 +86,4 @@ class ContactForm(forms.Form):
# checking whether they want to recover login information.
decline_password_recovery = forms.BooleanField(required=False, widget=forms.HiddenInput)


captcha = ReCaptchaField()
1 change: 1 addition & 0 deletions esp/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ django-filebrowser-no-grappelli==3.8.0 # Provides admin panel interface for file
django-form-utils==1.0.3 # Provides BetterForm (used in customforms) and BetterModelForm (used in program creation)
django-formtools==2.1 # Used once in customforms
django-localflavor==1.1 # Provides address and phone number fields
django-recaptcha==2.0.6 # Provides support for Google reCAPTCHA
django-reversion==1.10.0 # Handles versioning, currently for QSD and TemplateOverrides
django-selenium==0.9.8 # Runs selenium tests which probably don't work anymore
django-sendgrid-v5==0.9.0 # Provides support for using SendGrid as the EmailBackend
Expand Down

0 comments on commit 2840974

Please sign in to comment.