-
Notifications
You must be signed in to change notification settings - Fork 163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Captcha not rendered #232
Comments
Hi antoine1003 When you install the bundle and also the recipe, you have a custom one in In this the captcha is disabled ( Set it to |
Same issue here with symfony 5.4. The label is displayed but nothing else. It is not related to the enabled parameter. Something is strange because it is working well on another project with the same symfony version. @antoine1003 do you remember how did you solve this old problem ? Thx |
Hey @benjamin-aubry , <!-- Sample of my form -->
<div class="form-group">
{{ form_row(form.body) }}
</div>
<div class="form-group">
<div name="captcha" class="g-recaptcha" data-sitekey="{{ captcha_public }}"></div>
</div>
<!-- [...] -->
{% block javascript %}
<script src='https://www.google.com/recaptcha/api.js'></script>
{% endblock %} The captcha_public: 'my-google-key' and in the twig:
globals:
captcha_public: '%captcha_public%' And use google/recaptcha package to check in in my controller : if ($form->isSubmitted() && $form->isValid()) {
$recaptcha = new ReCaptcha($params->get('captcha_secret'));
$resp = $recaptcha->verify($request->request->get('g-recaptcha-response'), $request->getClientIp());
$contact = $form->getData();
$nbError = 0;
if (!$resp->isSuccess()) {
$message = $translator->trans('error.bad_captcha');
// Do something if the submit wasn't valid ! Use the message to show something
$this->addFlash('error', $message);
$nbError ++;
}
// ...
} I don't know if it helps but thats how I handled it 😃 |
Thx ! I let you know if I find what the problem is. |
Finallly in my case it was a config issue, I didn't notice that there is 2 config files so the solution given by @urkob worked. Thx ! |
Hi,
I installed this pluggin follow all steps but when I add the line :
->add('recaptcha', EWZRecaptchaType::class)
the form id not rendered.Here is aa photo of the bottom of my form :
The html of the field is :
Do you have any idea of what is happening?
The text was updated successfully, but these errors were encountered: