From 2dd84d27f0ce0f895f6f3fc7dbf1774bebf6ecd6 Mon Sep 17 00:00:00 2001 From: Simon Caminada Date: Mon, 7 Sep 2020 15:53:28 +0200 Subject: [PATCH] add recaptcha plugin --- requirements.in | 12 +++++++++++- settings.py | 7 +++++++ src/project/cms_plugins.py | 7 +------ 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/requirements.in b/requirements.in index 0578785..263c27c 100644 --- a/requirements.in +++ b/requirements.in @@ -21,4 +21,14 @@ django-image-cropping==1.2.0 django-anymail[mailgun]==1.4 django-admin-view-permission==1.9 gunicorn==19.9.0 -sentry-sdk==0.14.3 \ No newline at end of file +sentry-sdk==0.14.3 +aldryn-forms-recaptcha-plugin==1.0.0.2 +django-recaptcha2==1.4.1 +# compat versions +django-storages<1.9 +psycopg2<2.8 +django-parler<=2.1 +django-select2<=6.3.1 +django-sekizai<=1.1.0 +django-classy-tags<=1.0.0 +djangocms-attributes-field<=1.2.0 \ No newline at end of file diff --git a/settings.py b/settings.py index 1aef92a..119079a 100644 --- a/settings.py +++ b/settings.py @@ -38,6 +38,8 @@ aldryn_addons.settings.load(locals()) INSTALLED_APPS.insert(0, 'admin_view_permission') INSTALLED_APPS.extend([ + 'aldryn_forms_recaptcha_plugin', + 'snowpenguin.django.recaptcha3', 'portal', 'project', 'fontawesome', @@ -256,3 +258,8 @@ if not DEBUG: ] DATA_UPLOAD_MAX_MEMORY_SIZE = 1024 * 1024 * 1024 + +RECAPTCHA_PUBLIC_KEY = '6Lec78gZAAAAANc-oxXJPMi7BXmINlP-QkcS937g' +RECAPTCHA_PRIVATE_KEY = '6Lec78gZAAAAADuIppqW7cSh6iPw3TZQ9r-ogHtz' + +RECAPTCHA_SCORE_THRESHOLD = 0.5 diff --git a/src/project/cms_plugins.py b/src/project/cms_plugins.py index 1d145b9..5972fd7 100644 --- a/src/project/cms_plugins.py +++ b/src/project/cms_plugins.py @@ -203,12 +203,7 @@ class FormPlugin(_FormPlugin): module = 'Content' name = 'Form' child_classes = ['TextField', 'TextAreaField', 'EmailField', 'RadioSelectField', 'MultipleSelectField', - 'SubmitButton'] - - def send_notifications(self, instance, form): - if dict(form.get_serialized_field_choices()).get('honeypot', ''): - return [] - return super(FormPlugin, self).send_notifications(instance, form) + 'SubmitButton', 'ReCaptchaFieldPlugin'] class SocialMediaListItemInlineAdmin(admin.TabularInline):