From: test test Date: Wed, 16 Jun 2021 14:16:29 +0000 (+0200) Subject: Install new captcha X-Git-Tag: 2.1~66^2^2~22 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=dba0af551b59c040e0a0eccab85b2ce4decd2051;p=teleforma.git Install new captcha --- diff --git a/app/settings.py b/app/settings.py index 248be5cc..e58eaccd 100644 --- a/app/settings.py +++ b/app/settings.py @@ -184,7 +184,7 @@ INSTALLED_APPS = ( 'pdfannotator', # 'telemeta', 'rest_framework', - 'rest_framework.authtoken' + 'rest_framework.authtoken', ) @@ -280,9 +280,9 @@ FILE_UPLOAD_TEMP_DIR = '/tmp' SESSION_ENGINE = "unique_session.backends.session_backend" UNIQUE_SESSION_WHITELIST = (1, 2042) -# SOUTH_MIGRATION_MODULES = { -# 'captcha': 'captcha.south_migrations', -# } +RECAPTCHA_PUBLIC_KEY = '6Ldq5DgbAAAAADkKg19JXlhx6F1XUQDsrXfXqSP6' +RECAPTCHA_PRIVATE_KEY = '6Ldq5DgbAAAAAOVDOeF2kH8i2e2VSNHpqlinbpAJ' +RECAPTCHA_REQUIRED_SCORE = 0.85 # Cache backend is optional, but recommended to speed up user agent parsing # CACHES = { @@ -499,5 +499,5 @@ if DEBUG_TOOLBAR: } -USE_WEBPACK_DEV_SERVER = DEBUG -WEBPACK_DEV_SERVER_URL = "http://172.24.104.152:3000/" \ No newline at end of file +USE_WEBPACK_DEV_SERVER = False +WEBPACK_DEV_SERVER_URL = "http://172.24.104.152:3000/" diff --git a/app/urls.py b/app/urls.py index 0c18e06b..aef93771 100644 --- a/app/urls.py +++ b/app/urls.py @@ -35,7 +35,6 @@ urlpatterns = [ url(r'^tinymce/', include('tinymce.urls')), #url(r'^pdfviewer/', include('webviewer.urls')), url(r'^pdfannotator/', include('pdfannotator.urls')), - url(r'^captcha/', include('captcha.urls')), url(r'^messages/', include('postman.urls', namespace='postman')), ] + ([url(r'^__debug__/', include(debug_toolbar.urls)),] if DEBUG_ENV else []) diff --git a/requirements.txt b/requirements.txt index c2ecae4f..915b449d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -13,10 +13,10 @@ django-json-rpc==0.7.1 # django-google-tools==1.1.0 django-nvd3==0.8.2 django-postman==4.2 -django-simple-captcha==0.5.14 # a maj django-tinymce==3.3.0 -e git+https://git.parisson.com/git/django-unique-session.git@master#egg=django-unique-session django-user-agents==0.4.0 +django-recaptcha==2.0.6 jxmlease==1.0.3 mysqlclient==2.0.3 numpy==1.20.3 diff --git a/teleforma/forms.py b/teleforma/forms.py index e979d5c1..c5878702 100644 --- a/teleforma/forms.py +++ b/teleforma/forms.py @@ -2,7 +2,8 @@ import datetime from io import BytesIO -from captcha.fields import CaptchaField +from captcha.fields import ReCaptchaField + from django import forms from django.contrib.auth.models import User from django.core.exceptions import ValidationError @@ -117,7 +118,7 @@ class UserForm(ModelForm): widget=forms.Select()) # no model - captcha = CaptchaField() + captcha = ReCaptchaField() accept = BooleanField() class Meta: @@ -240,7 +241,7 @@ class CorrectorForm(ModelForm): queryset=Course.objects.all().exclude(title="Aucune").order_by('title'), widget=forms.CheckboxSelectMultiple()) # no model - captcha = CaptchaField() + captcha = ReCaptchaField() # accept = BooleanField() class Meta: diff --git a/teleforma/templates/registration/registration_form.html b/teleforma/templates/registration/registration_form.html index b8478c87..affee5a1 100644 --- a/teleforma/templates/registration/registration_form.html +++ b/teleforma/templates/registration/registration_form.html @@ -125,7 +125,6 @@ {{ form.captcha.errors }} - {{ form.captcha }} diff --git a/teleforma/urls.py b/teleforma/urls.py index cd5e54b1..e7ad4607 100644 --- a/teleforma/urls.py +++ b/teleforma/urls.py @@ -127,8 +127,6 @@ urlpatterns = [ template_name='registration/password_reset_complete.html'), name="teleforma-password-reset-complete"), - url(r'^captcha/', include('captcha.urls')), - # Help url(r'^help/$', HelpView.as_view(), name="teleforma-help"),