excelwebzone / EWZRecaptchaBundle

This bundle provides easy reCAPTCHA form field for Symfony.
MIT License
396 stars 160 forks source link

cant see in page #243

Closed xorgxx closed 4 years ago

xorgxx commented 4 years ago

Hi i have set on SF 5.0.8, PHP7.4.6

here are i set : .env

###> google/recaptcha ###
# To use Google Recaptcha, you must register a site on Recaptcha's admin panel:
# https://www.google.com/recaptcha/admin
GOOGLE_RECAPTCHA_SITE_KEY=6LfQdcoSAAAAAJZ........
GOOGLE_RECAPTCHA_SECRET=6LfQdcoSAAAAADK......
###< google/recaptcha ###

###> excelwebzone/recaptcha-bundle ###
EWZ_RECAPTCHA_SITE_KEY=
EWZ_RECAPTCHA_SECRET=
###< excelwebzone/recaptcha-bundle ###

dev/ewz_recaptcha.yaml

ewz_recaptcha:
    enabled: true

ewz_recaptcha.yaml

ewz_recaptcha:
    public_key:  '%env(EWZ_RECAPTCHA_SITE_KEY)%'
    private_key: '%env(EWZ_RECAPTCHA_SECRET)%'

    locale_key:  "%kernel.default_locale%"
    locale_from_request: true
    enabled: true
#    ajax: true

FromType.php

use EWZ\Bundle\RecaptchaBundle\Form\Type\EWZRecaptchaType;
use EWZ\Bundle\RecaptchaBundle\Validator\Constraints\IsTrue as RecaptchaTrue;
........
           ->add('recaptcha', EWZRecaptchaType::class, array(
                    'attr' => array(
                        'options' => array(
                            'theme' => 'light',
                            'type' => 'image',
                            'size' => 'normal',
                            'defer' => true,
                            'async' => true,
                        ),
                    ),
                    /*
                     * @Recaptcha\IsTrue()
                     */
                    'label' => true,
                    'mapped' => false,
                    'constraints' => array(
                        new RecaptchaTrue(),
                    ),
                )
            );

View.html.twig

{% form_theme form '@EWZRecaptcha/Form/ewz_recaptcha_widget.html.twig' %}
.......

        {{ form_label(form.recaptcha) }}
        {{ form_widget(form.recaptcha) }}

in the page i can see only "1", this is what i get in source page :

div class="col_half ">
    <label class="col-form-label col-sm-2 required" for="mail_contact_recaptcha">1</label>
    <script type="text/javascript" async=""
            src="https://www.gstatic.com/recaptcha/releases/HYx6hBAtwYatsD8qzq7tXNTk/recaptcha__fr.js"></script>
    <script type="text/javascript" src="https://www.google.com/recaptcha/api.js?hl=fr" defer="" async=""></script>
    <div class="g-recaptcha" data-theme="light" data-size="normal" data-type="image" data-sitekey=""></div>
    <noscript>
        <div style="width: 302px; height: 352px;">
            <div style="width: 302px; height: 352px; position: relative;">
                <div style="width: 302px; height: 352px; position: absolute;">
                    <iframe src="https://www.google.com/recaptcha/api/fallback?k="
                            frameborder="0" scrolling="no"
                            style="width: 302px; height:352px; border-style: none;"
                    ></iframe>
                </div>
                <div style="width: 250px; height: 80px; position: absolute; border-style: none; bottom: 21px; left: 25px; margin: 0; padding: 0; right: 25px;"><textarea
                            id="g-recaptcha-response" name="g-recaptcha-response"
                            class="g-recaptcha-response"
                            style="width: 250px; height: 80px; border: 1px solid #c1c1c1; margin: 0; padding: 0; resize: none;"
                    ></textarea></div>
            </div>
        </div>
    </noscript>
</div>

where deed i get the misteck ??? can you help.

xorgxx commented 4 years ago

OK i find the probleme : it's maybe i have to sleep more !!!!

> excelwebzone/recaptcha-bundle

EWZ_RECAPTCHA_SITE_KEY= <<<<<< here have to put key >>>>>> EWZ_RECAPTCHA_SECRET= <<<<<< here have to put key >>>>>>

< excelwebzone/recaptcha-bundle

thank