add captcha
This commit is contained in:
parent
e2e8e2ed79
commit
eedfb4c9f2
|
@ -109,6 +109,35 @@ pre[class*="language-"] {
|
||||||
textarea {
|
textarea {
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&-captcha {
|
||||||
|
label {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
img {
|
||||||
|
vertical-align: middle;
|
||||||
|
margin-right: 10px;
|
||||||
|
border-radius: 10px;
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
input {
|
||||||
|
display: inline-block;
|
||||||
|
width: 100px !important;
|
||||||
|
height: 50px !important;
|
||||||
|
margin-bottom: -1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-error-icon {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-error-message {
|
||||||
|
display: block;
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.button, .btn, input[type="submit"], input[type="button"] {
|
.button, .btn, input[type="submit"], input[type="button"] {
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
"php": ">=8.0.0",
|
"php": ">=8.0.0",
|
||||||
"beberlei/doctrineextensions": "^1.3",
|
"beberlei/doctrineextensions": "^1.3",
|
||||||
"friendsofsymfony/jsrouting-bundle": "^2.7",
|
"friendsofsymfony/jsrouting-bundle": "^2.7",
|
||||||
|
"gregwar/captcha-bundle": "^2.2",
|
||||||
"knplabs/knp-markdown-bundle": "^1.9",
|
"knplabs/knp-markdown-bundle": "^1.9",
|
||||||
"knplabs/knp-menu-bundle": "^3.1",
|
"knplabs/knp-menu-bundle": "^3.1",
|
||||||
"murph/murph-core": "dev-master"
|
"murph/murph-core": "dev-master"
|
||||||
|
|
|
@ -24,4 +24,5 @@ return [
|
||||||
Knp\DoctrineBehaviors\DoctrineBehaviorsBundle::class => ['all' => true],
|
Knp\DoctrineBehaviors\DoctrineBehaviorsBundle::class => ['all' => true],
|
||||||
SPE\FilesizeExtensionBundle\SPEFilesizeExtensionBundle::class => ['all' => true],
|
SPE\FilesizeExtensionBundle\SPEFilesizeExtensionBundle::class => ['all' => true],
|
||||||
Liip\ImagineBundle\LiipImagineBundle::class => ['all' => true],
|
Liip\ImagineBundle\LiipImagineBundle::class => ['all' => true],
|
||||||
|
Gregwar\CaptchaBundle\GregwarCaptchaBundle::class => ['all' => true],
|
||||||
];
|
];
|
||||||
|
|
|
@ -15,6 +15,7 @@ use Symfony\Component\Validator\Constraints\Email;
|
||||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||||
use Symfony\Component\Validator\Constraints\Url;
|
use Symfony\Component\Validator\Constraints\Url;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
||||||
|
use Gregwar\CaptchaBundle\Type\CaptchaType;
|
||||||
|
|
||||||
class UserCommentType extends AbstractType
|
class UserCommentType extends AbstractType
|
||||||
{
|
{
|
||||||
|
@ -86,6 +87,19 @@ class UserCommentType extends AbstractType
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$builder->add(
|
||||||
|
'captcha',
|
||||||
|
CaptchaType::class,
|
||||||
|
[
|
||||||
|
'invalid_message' => 'Code invalide',
|
||||||
|
'label' => 'Captcha',
|
||||||
|
'max_front_lines' => 1,
|
||||||
|
'width' => 140,
|
||||||
|
'height' => 50,
|
||||||
|
'length' => 3,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
$builder->add(
|
$builder->add(
|
||||||
'parentCommentId',
|
'parentCommentId',
|
||||||
HiddenType::class,
|
HiddenType::class,
|
||||||
|
|
|
@ -10,6 +10,7 @@ use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
use Symfony\Component\Validator\Constraints\Email;
|
use Symfony\Component\Validator\Constraints\Email;
|
||||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||||
|
use Gregwar\CaptchaBundle\Type\CaptchaType;
|
||||||
|
|
||||||
class ContactType extends AbstractType
|
class ContactType extends AbstractType
|
||||||
{
|
{
|
||||||
|
@ -71,6 +72,19 @@ class ContactType extends AbstractType
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$builder->add(
|
||||||
|
'captcha',
|
||||||
|
CaptchaType::class,
|
||||||
|
[
|
||||||
|
'invalid_message' => 'Code invalide',
|
||||||
|
'label' => 'Captcha',
|
||||||
|
'max_front_lines' => 1,
|
||||||
|
'width' => 140,
|
||||||
|
'height' => 50,
|
||||||
|
'length' => 3,
|
||||||
|
]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function configureOptions(OptionsResolver $resolver)
|
public function configureOptions(OptionsResolver $resolver)
|
||||||
|
|
|
@ -36,6 +36,10 @@
|
||||||
{{ form_errors(form.message) }}
|
{{ form_errors(form.message) }}
|
||||||
{{ form_widget(form.message, {attr: {cols: 30, rows: 10}}) }}
|
{{ form_widget(form.message, {attr: {cols: 30, rows: 10}}) }}
|
||||||
</div>
|
</div>
|
||||||
|
<div class="field field-captcha">
|
||||||
|
{{ form_label(form.captcha) }}
|
||||||
|
{{ form_widget(form.captcha) }}
|
||||||
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<input type="checkbox" id="rgpd" required>
|
<input type="checkbox" id="rgpd" required>
|
||||||
<label for="rgpd">En validant ce formulaire, vous acceptez que j'utilise votre e-mail pour vous fournir une réponse.</label>
|
<label for="rgpd">En validant ce formulaire, vous acceptez que j'utilise votre e-mail pour vous fournir une réponse.</label>
|
||||||
|
|
|
@ -180,7 +180,10 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="field field-captcha">
|
||||||
|
{{ form_label(form.captcha) }}
|
||||||
|
{{ form_widget(form.captcha) }}
|
||||||
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<input type="checkbox" id="rgpd" required>
|
<input type="checkbox" id="rgpd" required>
|
||||||
<label for="rgpd">En validant ce formulaire, vous acceptez que les données saisies seront publiées sur cette page à l'exception de votre e-mail. Votre e-mail sera utilisé pour afficher votre avatar (<a href="https://www.libravatar.org/" target="_blank">via Libravatar</a>) et pour les notifications.</label>
|
<label for="rgpd">En validant ce formulaire, vous acceptez que les données saisies seront publiées sur cette page à l'exception de votre e-mail. Votre e-mail sera utilisé pour afficher votre avatar (<a href="https://www.libravatar.org/" target="_blank">via Libravatar</a>) et pour les notifications.</label>
|
||||||
|
|
Loading…
Reference in New Issue