]> git.parisson.com Git - teleforma.git/commitdiff
Install new captcha
authortest test <yoanl@pilotsystems.net>
Wed, 16 Jun 2021 14:16:29 +0000 (16:16 +0200)
committerYoan Le Clanche <yoanl@pilotsystems.net>
Wed, 16 Jun 2021 14:16:29 +0000 (16:16 +0200)
app/settings.py
app/urls.py
requirements.txt
teleforma/forms.py
teleforma/templates/registration/registration_form.html
teleforma/urls.py

index 248be5ccf03950afc88bd3b0d7c4aee142a7a157..e58eaccdb2a20ef4d51a3cdac792633b89f2df27 100644 (file)
@@ -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/"
index 0c18e06b56d0f4fd8967446ab51afaef8ae90168..aef93771563bd44148946f4472b630d325408aeb 100644 (file)
@@ -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 [])
 
index c2ecae4f9f4f23940bbbd28731cb57d933e6c7fa..915b449daffb1e27494392d47954f421b2a12ab5 100644 (file)
@@ -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
index e979d5c1f5107a5a40c0348e417bc7663c2a37e4..c587870225022dfd14ed28a0520892c044f67514 100644 (file)
@@ -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:
index b8478c873056d6ae31c01b8e5a3dc00a83844a39..affee5a166a6213e6e329964f23a8d35368fab2b 100644 (file)
                 <span class="error">
                     {{ form.captcha.errors }}
                 </span>
-                <label for="id_captcha_1">{{ form.captcha.label }}*</label>
                 {{ form.captcha }}
             </div>
         </div>
index cd5e54b18633864851240387daf4523412e17249..e7ad4607e4d21207f215c8d95fe265c4faf17e08 100644 (file)
@@ -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"),