Merge branch 'aureplop/captcha' into 'master'

Upgrade to reCAPTCHA v2

Closes #192

See merge request cof-geek/gestioCOF!299
This commit is contained in:
Martin Pepin 2018-05-14 17:55:37 +02:00
commit 20cc2e7345
4 changed files with 15 additions and 6 deletions

View file

@ -42,9 +42,6 @@ REDIS_DB = import_secret("REDIS_DB")
REDIS_HOST = import_secret("REDIS_HOST")
REDIS_PORT = import_secret("REDIS_PORT")
RECAPTCHA_PUBLIC_KEY = import_secret("RECAPTCHA_PUBLIC_KEY")
RECAPTCHA_PRIVATE_KEY = import_secret("RECAPTCHA_PRIVATE_KEY")
KFETOPEN_TOKEN = import_secret("KFETOPEN_TOKEN")
LDAP_SERVER_URL = import_secret("LDAP_SERVER_URL")
@ -207,6 +204,14 @@ AUTHENTICATION_BACKENDS = (
'kfet.auth.backends.GenericBackend',
)
# reCAPTCHA settings
# https://github.com/praekelt/django-recaptcha
#
# Default settings authorize reCAPTCHA usage for local developement.
# Public and private keys are appended in the 'prod' module settings.
NOCAPTCHA = True
RECAPTCHA_USE_SSL = True
CORS_ORIGIN_WHITELIST = (

View file

@ -6,7 +6,7 @@ The settings that are not listed here are imported from .common
import os
from .common import * # NOQA
from .common import BASE_DIR
from .common import BASE_DIR, import_secret
DEBUG = False
@ -28,3 +28,7 @@ STATIC_ROOT = os.path.join(
STATIC_URL = "/gestion/static/"
MEDIA_ROOT = os.path.join(os.path.dirname(BASE_DIR), "media")
MEDIA_URL = "/gestion/media/"
RECAPTCHA_PUBLIC_KEY = import_secret("RECAPTCHA_PUBLIC_KEY")
RECAPTCHA_PRIVATE_KEY = import_secret("RECAPTCHA_PRIVATE_KEY")

View file

@ -7,7 +7,7 @@
{% if success %}
<p class="success">Votre demande a été enregistrée avec succès !</p>
{% else %}
<form id="demandecours" method="post" action="{% url "gestioncof.petits_cours_views.demande_raw" %}">
<form id="demandecours" method="post" action="{% url "petits-cours-demande-raw" %}">
{% csrf_token %}
<table>
{{ form | bootstrap }}

View file

@ -4,7 +4,7 @@ django-autocomplete-light==3.1.3
django-autoslug==1.9.3
django-cas-ng==3.5.7
django-djconfig==0.5.3
django-recaptcha==1.2.1
django-recaptcha==1.4.0
django-redis-cache==1.7.1
icalendar
psycopg2