michaelvs97 / AspNetCore.ReCaptcha

Google ReCAPTCHA v2/v3 Library for .NET Core 3.x/5.x
https://www.nuget.org/packages/AspNetCore.ReCaptcha/
MIT License
73 stars 20 forks source link

Is it possible to have the recaptcha tag on a page twice? #43

Closed thomasonk closed 1 year ago

thomasonk commented 2 years ago

I have two forms on some pages and I found that the g-recaptcha-response was only populated for the first tag on the page.

Is it possible to have the tag on the page twice? If not currently, could ids be put on the tags to match up to the corresponding tags?

michaelvs97 commented 2 years ago

Hello @thomasonk,

Thanks for reporting this issue. We will investigate the problem, and get a fix out as soon as possible - if it turns out a change is needed in the package. If so, we will give you a heads up as soon as we published a fix on NuGet.

Otherwise, I will make sure to help you out by explaining how you could tackle this case.

Have a nice day!

michaelvs97 commented 2 years ago

Hello @thomasonk,

We tried reproducing the issue you are describing. Unfortunately, we didn't succeed in reproducing the issue. We added two recaptcha's on one page, and were able to validate both of them.

Which version of the library are you using? Can you supply a small repo with code in which the issue occurs? That might be helpful in tracking down whether this is a bug or not.

Thanks in advance, and have a nice day!

thomasonk commented 2 years ago

I was using 1.5.3 but I upgraded to 1.5.4 since it looks like this may have been fixed by this code change https://github.com/michaelvs97/AspNetCore.ReCaptcha/commit/da70a479f61dbd5f556f0bc7c5e60ff34af7ad15 However, I am still seeing issues with the two forms. I am using recaptcha V3 and I am adding recaptcha to the page using the tag But it looks like the g-recaptcha-response is always added with the -1 regardless of what id I specify. Am I doing something wrong or can I not specify the id this way?

sleeuwen commented 1 year ago

Hi @thomasonk , We've just published v1.6.0 which also contains a fix for this issue, could you test that version and see if it works for you?