recaptcha form fix
This commit is contained in:
2
bin/gulp
2
bin/gulp
@@ -1,2 +1,2 @@
|
||||
#/bin/bash
|
||||
exec docker-compose run --rm web gulp "$@" --debug
|
||||
exec docker-compose run --rm web gulp "$@" --inspect
|
||||
|
||||
@@ -13,11 +13,14 @@ $(function() {
|
||||
url: $form.attr('action'),
|
||||
data: $form.serialize(),
|
||||
success: function(data) {
|
||||
django_recaptcha_callbacks = [];
|
||||
var $new = $(data).find('#' + id);
|
||||
$new.find('.reveal').each(function() {
|
||||
$(this).removeClass('reveal reveal_animation');
|
||||
});
|
||||
$new.removeClass('reveal reveal_animation');
|
||||
$form.replaceWith($new);
|
||||
djangoRecaptchaOnLoadCallback();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -21,7 +21,6 @@ django-image-cropping==1.2.0
|
||||
django-admin-view-permission==1.9
|
||||
gunicorn==19.9.0
|
||||
sentry-sdk==0.14.3
|
||||
aldryn-forms-recaptcha-plugin==1.0.0.2
|
||||
django-recaptcha2==1.4.1
|
||||
# compat versions
|
||||
django-storages<1.9 # https://stackoverflow.com/questions/60297619/divio-importerror-cannot-import-name-s3boto
|
||||
@@ -32,3 +31,4 @@ django-sekizai<=1.1.0
|
||||
django-classy-tags<=1.0.0
|
||||
djangocms-attributes-field<=1.2.0
|
||||
django-haystack==2.8.1
|
||||
django-simple-captcha==0.5.12
|
||||
@@ -38,8 +38,7 @@ aldryn_addons.settings.load(locals())
|
||||
|
||||
INSTALLED_APPS.insert(0, 'admin_view_permission')
|
||||
INSTALLED_APPS.extend([
|
||||
'aldryn_forms_recaptcha_plugin',
|
||||
'snowpenguin.django.recaptcha3',
|
||||
'snowpenguin.django.recaptcha2',
|
||||
'portal',
|
||||
'project',
|
||||
'fontawesome',
|
||||
@@ -261,7 +260,7 @@ if not DEBUG:
|
||||
|
||||
DATA_UPLOAD_MAX_MEMORY_SIZE = 1024 * 1024 * 1024
|
||||
|
||||
RECAPTCHA_PUBLIC_KEY = '6Lec78gZAAAAANc-oxXJPMi7BXmINlP-QkcS937g'
|
||||
RECAPTCHA_PRIVATE_KEY = '6Lec78gZAAAAADuIppqW7cSh6iPw3TZQ9r-ogHtz'
|
||||
RECAPTCHA_PUBLIC_KEY = '6LeILd0ZAAAAAB9xO_y8kS292wv2ikl0M8s7zFn9'
|
||||
RECAPTCHA_PRIVATE_KEY = '6LeILd0ZAAAAAOGF1AvxdiGcXWLjr2BzHaQ8Zush'
|
||||
|
||||
RECAPTCHA_SCORE_THRESHOLD = 0.5
|
||||
|
||||
@@ -8,6 +8,9 @@ from djangocms_picture.cms_plugins import PicturePlugin as _PicturePlugin
|
||||
from djangocms_text_ckeditor.cms_plugins import TextPlugin as _TextPlugin
|
||||
from django.contrib import admin
|
||||
from mailchimp3 import MailChimp
|
||||
from aldryn_forms.cms_plugins import Field
|
||||
from snowpenguin.django.recaptcha2.fields import ReCaptchaField
|
||||
from snowpenguin.django.recaptcha2.widgets import ReCaptchaWidget
|
||||
|
||||
from project.forms import NewsletterSubscriptionForm
|
||||
from project.models import Section, Quote, SliderItem, SectionText, Video, DownloadSection, DownloadSectionFolder, \
|
||||
@@ -206,6 +209,24 @@ class FormPlugin(_FormPlugin):
|
||||
'SubmitButton', 'ReCaptchaFieldPlugin']
|
||||
|
||||
|
||||
@plugin_pool.register_plugin
|
||||
class ReCaptchaFieldPlugin(Field):
|
||||
name = 'ReCaptcha Field'
|
||||
render_template = True
|
||||
allow_children = False
|
||||
form_field = ReCaptchaField
|
||||
form_field_widget = ReCaptchaWidget
|
||||
|
||||
form_field_enabled_options = [
|
||||
'error_messages',
|
||||
]
|
||||
fieldset_general_fields = []
|
||||
fieldset_advanced_fields = []
|
||||
|
||||
def get_form_field_widget_kwargs(self, instance):
|
||||
return {'explicit': True}
|
||||
|
||||
|
||||
class SocialMediaListItemInlineAdmin(admin.TabularInline):
|
||||
model = SocialMediaListItem
|
||||
extra = 0
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{% load static i18n cms_tags sekizai_tags fontawesome menu_tags %}<!DOCTYPE html>
|
||||
{% load static i18n cms_tags sekizai_tags fontawesome menu_tags recaptcha2 %}<!DOCTYPE html>
|
||||
<html class="r" lang="{{ LANGUAGE_CODE }}">
|
||||
<head>
|
||||
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
||||
@@ -10,6 +10,8 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="google" content="notranslate">
|
||||
|
||||
{% recaptcha_explicit_support %}
|
||||
|
||||
<meta name="msvalidate.01" content="7E7A1E68251AEDF0AF320164C774E3E8"/>
|
||||
|
||||
{% block extra_meta %}
|
||||
@@ -233,5 +235,7 @@
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
{% recaptcha_explicit_init LANGUAGE_CODE %}
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user