Commit d3e25ca3 by Julien Jorry

Contact form : add captcha to avoid spam

parent 4b8c493b
......@@ -46,4 +46,9 @@ legend.required:after {
#formPrestataireInfos_media .custom-file-label {
border: 0px;
}
/*For captcha bundle : https://github.com/Gregwar/CaptchaBundle*/
.invalid-feedback {
display: inline-block !important;
}
\ No newline at end of file
......@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "5dea76ca9c7063f5bdc7d0b05e8aede9",
"content-hash": "f84e000eb2ef1987e7a9e7977d5d0843",
"packages": [
{
"name": "alcohol/iso4217",
......@@ -3312,6 +3312,120 @@
"time": "2020-12-19T09:41:04+00:00"
},
{
"name": "gregwar/captcha",
"version": "v1.1.9",
"source": {
"type": "git",
"url": "https://github.com/Gregwar/Captcha.git",
"reference": "4bb668e6b40e3205a020ca5ee4ca8cff8b8780c5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Gregwar/Captcha/zipball/4bb668e6b40e3205a020ca5ee4ca8cff8b8780c5",
"reference": "4bb668e6b40e3205a020ca5ee4ca8cff8b8780c5",
"shasum": ""
},
"require": {
"ext-gd": "*",
"ext-mbstring": "*",
"php": ">=5.3.0",
"symfony/finder": "*"
},
"require-dev": {
"phpunit/phpunit": "^6.4"
},
"type": "captcha",
"autoload": {
"psr-4": {
"Gregwar\\": "src/Gregwar"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Grégoire Passault",
"email": "g.passault@gmail.com",
"homepage": "http://www.gregwar.com/"
},
{
"name": "Jeremy Livingston",
"email": "jeremy.j.livingston@gmail.com"
}
],
"description": "Captcha generator",
"homepage": "https://github.com/Gregwar/Captcha",
"keywords": [
"bot",
"captcha",
"spam"
],
"time": "2020-03-24T14:39:05+00:00"
},
{
"name": "gregwar/captcha-bundle",
"version": "v2.1.5",
"source": {
"type": "git",
"url": "https://github.com/Gregwar/CaptchaBundle.git",
"reference": "2f96c759abae9c914856b9b9fc909268ba98a625"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Gregwar/CaptchaBundle/zipball/2f96c759abae9c914856b9b9fc909268ba98a625",
"reference": "2f96c759abae9c914856b9b9fc909268ba98a625",
"shasum": ""
},
"require": {
"ext-gd": "*",
"gregwar/captcha": "^1.1.9",
"php": ">=7.1.3",
"symfony/form": "~4.0|~5.0",
"symfony/framework-bundle": "~4.0|~5.0",
"symfony/translation": "~4.0|^5.0",
"twig/twig": "^2.10|^3.0"
},
"require-dev": {
"symplify/easy-coding-standard": "^6.1"
},
"type": "symfony-bundle",
"autoload": {
"psr-4": {
"Gregwar\\CaptchaBundle\\": "/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Grégoire Passault",
"email": "g.passault@gmail.com",
"homepage": "http://www.gregwar.com/"
},
{
"name": "Jeremy Livingston",
"email": "jeremy.j.livingston@gmail.com"
}
],
"description": "Captcha bundle",
"homepage": "https://github.com/Gregwar/CaptchaBundle",
"keywords": [
"Symfony2",
"bot",
"captcha",
"code",
"security",
"spam",
"symfony",
"visual"
],
"time": "2021-04-20T07:20:37+00:00"
},
{
"name": "guzzlehttp/guzzle",
"version": "6.5.5",
"source": {
......@@ -5188,12 +5302,12 @@
"target-dir": "Ambta/DoctrineEncryptBundle",
"source": {
"type": "git",
"url": "https://github.com/michaeldegroot/DoctrineEncryptBundle.git",
"url": "https://github.com/absolute-quantum/DoctrineEncryptBundle.git",
"reference": "7ff178b554409f8fc3c005d1b089f9551de0c24a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/michaeldegroot/DoctrineEncryptBundle/zipball/7ff178b554409f8fc3c005d1b089f9551de0c24a",
"url": "https://api.github.com/repos/absolute-quantum/DoctrineEncryptBundle/zipball/7ff178b554409f8fc3c005d1b089f9551de0c24a",
"reference": "7ff178b554409f8fc3c005d1b089f9551de0c24a",
"shasum": ""
},
......@@ -8427,6 +8541,7 @@
"type": "github"
}
],
"abandoned": true,
"time": "2021-01-27T16:06:50+00:00"
},
{
......@@ -8676,6 +8791,7 @@
"Easy Extends",
"sonata"
],
"abandoned": true,
"time": "2018-02-11T12:21:41+00:00"
},
{
......@@ -9760,6 +9876,7 @@
"type": "tidelift"
}
],
"abandoned": "symfony/mailer",
"time": "2021-01-12T09:35:59+00:00"
},
{
......@@ -11571,7 +11688,7 @@
"type": "tidelift"
}
],
"abandoned": "use `EnglishInflector` from the String component instead",
"abandoned": "EnglishInflector from the String component",
"time": "2021-07-21T12:19:41+00:00"
},
{
......@@ -18197,6 +18314,7 @@
"type": "github"
}
],
"abandoned": true,
"time": "2020-09-28T06:45:17+00:00"
},
{
......@@ -19209,6 +19327,7 @@
"issues": "https://github.com/webmozart/path-util/issues",
"source": "https://github.com/webmozart/path-util/tree/2.3.0"
},
"abandoned": "symfony/filesystem",
"time": "2015-12-17T08:42:14+00:00"
}
],
......
......@@ -59,4 +59,5 @@ return [
SpecShaper\EncryptBundle\SpecShaperEncryptBundle::class => ['all' => true],
SpecShaper\GdprBundle\SpecShaperGdprBundle::class => ['all' => true],
Cron\CronBundle\CronCronBundle::class => ['all' => true],
Gregwar\CaptchaBundle\GregwarCaptchaBundle::class => ['all' => true],
];
gregwar_captcha:
width: 160
height: 50
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -6,7 +6,7 @@
"/build/app.498d6ed6.js"
],
"css": [
"/build/app.b8845846.css"
"/build/app.1fb37df4.css"
]
},
"admin": {
......
{
"build/app.css": "/build/app.b8845846.css",
"build/app.css": "/build/app.1fb37df4.css",
"build/app.js": "/build/app.498d6ed6.js",
"build/admin.css": "/build/admin.87a6bc21.css",
"build/admin.js": "/build/admin.7f86a232.js",
......
......@@ -2,6 +2,7 @@
namespace App\Form\Type;
use Gregwar\CaptchaBundle\Type\CaptchaType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
......@@ -26,6 +27,7 @@ class ContactFormType extends AbstractType
'label' => 'Votre message :',
'required' => true
))
->add('captcha', CaptchaType::class)
->add('save', SubmitType::class, ['label' => "Envoyer"])
;
}
......
......@@ -227,6 +227,12 @@
"gitonomy/gitlib": {
"version": "v1.2.2"
},
"gregwar/captcha": {
"version": "v1.1.9"
},
"gregwar/captcha-bundle": {
"version": "v2.1.5"
},
"guzzlehttp/guzzle": {
"version": "6.3.3"
},
......
{% extends '@kohinos/common/layout.html.twig' %}
{% form_theme form _self %}
{% block captcha_widget %}
{% if is_human %}
-
{% else %}
{% apply spaceless %}
<div class='w-100 text-center mb-2'>
<img class="captcha_image d-inline-block" id="{{ image_id }}" src="{{ captcha_code }}" alt="" title="captcha" width="{{ captcha_width }}" height="{{ captcha_height }}" />
</div>
{% if reload %}
<script type="text/javascript">
function reload_{{ image_id }}() {
var img = document.getElementById('{{ image_id }}');
img.src = '{{ captcha_code }}?n=' + (new Date()).getTime();
}
</script>
<a class="captcha_reload" href="javascript:reload_{{ image_id }}();">{{ 'Renew'|trans({}, 'gregwar_captcha') }}</a>
{% endif %}
{{ form_widget(form) }}
{% endapply %}
{% endif %}
{% endblock %}
{% block content %}
<div class='container homepage'>
{% include '@kohinos/block/breadcrumb.html.twig' with {'label' : 'Contact'} %}
......@@ -11,6 +37,7 @@
{{ form_row(form.nom) }}
{{ form_row(form.email) }}
{{ form_row(form.message) }}
{{ form_row(form.captcha) }}
{{ form_row(form.save) }}
{{form_end(form)}}
</div>
......
......@@ -259,4 +259,5 @@ Cotiser: Cotiser
'Une erreur est survenue due à la configuration du paiement dans l''application. Il est pour l''instant impossible de payer par CB, merci de contacter votre monnaie locale.': 'Une erreur est survenue due à la configuration du paiement dans l''application. Il est pour l''instant impossible de payer par CB, merci de contacter votre monnaie locale.'
Cotisation: Cotisation
'Votre adhésion a bien été prise en compte, bienvenue !': 'Votre adhésion a bien été prise en compte, bienvenue !'
'Décharger prestataire': 'Décharger prestataire'
\ No newline at end of file
'Décharger prestataire': 'Décharger prestataire'
invalid_message: 'Captcha invalide !'
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment