thinhbuzz / laravel-google-captcha

Google captcha for Laravel 5, Laravel 6, Laravel 7, Laravel 8, Laravel 9 and Laravel 10, support multiple captcha on page
MIT License
201 stars 32 forks source link

Support for invisible reCAPTCHAs #44

Closed hohl closed 4 years ago

hohl commented 4 years ago

Are invisible reCAPTCHAs supported through this library?

I tried to use this library with the invisible data attribute (see v2 reCAPTCHA docs by Google):

{!! Captcha::display(['data-size' => 'invisible']) !!}

While this line hides the captcha, it also causes the validation to fail afterwards. Looking at Google documentation this flag should be the only change needed, but I can not figure out, why it does not work with this plugin. Any ideas? Or, maybe anybody here activly uses the invisible reCAPTCHAs already with this library?

thinhbuzz commented 4 years ago

I will take a look tomorrow

thinhbuzz commented 4 years ago

@hohl you can try this example invisible.blade.php

nelsonfsa commented 4 years ago

Fixed it by adding this to my view:

grecaptcha.execute();

hohl commented 4 years ago

Thanks, yes adding grecaptcha.execute() as suggested by @nelsonfsa and as already shown in your above sample seems to be enough to get the invisible captchas working.

Thanks for the help and thanks in general for providing us with that library.