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
200 stars 32 forks source link

Does not reset multi captcha #28

Closed DmitrySkibitsky closed 6 years ago

DmitrySkibitsky commented 6 years ago

js output

<script type="text/javascript">
var buzzNoCaptchaWidgetIds={};
var buzzNoCaptchaOnLoadCallback=function( {
buzzNoCaptchaWidgetIds["captcha_create_comment"]=grecaptcha.render('captcha_create_comment',
{"sitekey":"6LdVmDEUAAAAABEyMLp_V2Yr52KOYC19aovieDuE", "id":"captcha_create_comment"}
);
buzzNoCaptchaWidgetIds["captcha_create_consultation"]=grecaptcha.render('captcha_create_consultation',
{"sitekey":"6LdVmDEUAAAAABEyMLp_V2Yr52KOYC19aovieDuE","id":"captcha_create_consultation"}
);
buzzNoCaptchaWidgetIds["captcha_create_appointment"]=grecaptcha.render('captcha_create_appointment',
{"sitekey":"6LdVmDEUAAAAABEyMLp_V2Yr52KOYC19aovieDuE","id":"captcha_create_appointment"}
);
};</script>

I execute in the console

grecaptcha.reset(buzzNoCaptchaWidgetIds['captcha_create_consultation']);

As a result, the first captcha in the list of objects is reset (id captcha_create_comment) Works as I understood on the same principle as before: the first counter is reset

thinhbuzz commented 6 years ago

you can post full source code? I try with this code and package working perfectly: multiple.blade.php

DmitrySkibitsky commented 6 years ago

@thinhbuzz , http://gclinic.ck.ua/contacts is the page on which I tested. If it does not make it difficult to look in the source code or try to reset it in the console and tell me what's wrong.

function in which I tried to reset the captcha

function resetCaptcha(id) {
    grecaptcha.reset(buzzNoCaptchaWidgetIds[id]);
}
DmitrySkibitsky commented 6 years ago

Okay, I'm probably doing something wrong.

DmitrySkibitsky commented 6 years ago

https://github.com/DmitrySkibitsky/laravel-site-psychotherapy is source project

thinhbuzz commented 6 years ago

ok, i see 3 issue:

  1. not need put lang, sitekey, multiple into display method
  2. displayJs must be define before displayMultiple
  3. can not use multiple or setOptions in master layout because section will be render before for issue 3, i will be add default options to config file

And finally: options pass to display method does not apply global, if you want apply options for all captcha you can use setOptions method before render view

Thanks.

thinhbuzz commented 6 years ago

default options/attributes in config has been release on version 2.1.10 or you can use setOptions method before render view fixed in 848bacbd4f24b7d4e802f7048dcedbed3cc830d5

DmitrySkibitsky commented 6 years ago

@thinhbuzz , Thank you. Tomorrow I will understand.

thinhbuzz commented 6 years ago

you are wellcome