Closed Panzerfury closed 4 years ago
Hi, i guess please make sure you are using the updated version of the package for 3.1. Other wise if you have already done this, you would need more information about how you are using it. V3Invis should have a logo on the right hand corner of the page (recaptcha logo) if you don't see that check the console in you browser for errors. Normally an empty response on happens if the page sits for too long.
If you are still having issues please post more examples of how your using (just a small block of code around the @html tag etc.. hopefully others can help as well.
I'm using the latest version of the package. The recaptcha logo is also at the buttom of the page.
Here is a small code sample
<div class="form-group">
<div class="column" style="direction: rtl;">
@(Html.Recaptcha<RecaptchaV3HiddenInput>(RecaptchaSettings.Value))
</div>
</div>
This code is inside a form.
@TimothyMeadows I'm also using the latest NuGet package and I can confirm that something went wrong. g-recaptcha-response is also empty. It worked correctly some time ago. All configuration entries are okay, serviceCollection.AddRecaptcha(...) method call exists. In razor view: @(Html.Recaptcha
@TimothyMeadows
Seems like I could found a reason of this issue:
grecaptcha.ready is not being called because main JS file is loaded using "async defer". Recaptcha documentation says that you should embed JS script in the following way:
<script src="https://www.google.com/recaptcha/api.js?render=reCAPTCHA_site_key"></script>
without "async defer" attributes. In this case everything works correctly. Currently JS file is linked with the following code:
@shelland Thank you! I have this problem too. I use Razor Pages.
It helps me::
@(Html.Recaptcha(RecaptchaSettings.Value, new RecaptchaV3HiddenInput { IsAsync = false }))
@TimothyMeadows
The solution above needs moving to the homepage so others aren't wasting time over this.
This is likely to not occur, i can't document every special use case in the README. However, this can be linked to for future users that might run into the issue. IsAsync exists for a reason.
Added a link to the bottom of readme for this issue, and other special cases.
perhaps unnecessarily but V3HiddenInput is in the 'versions' namespace and not in the 'templates' namespace
This is likely to not occur, i can't document every special use case in the README. However, this can be linked to for future users that might run into the issue. IsAsync exists for a reason.
My page is a bog standard MVC Razor page, not exactly a special case
Hello. I've used this lib with great success in my .net core 2.2 project. Now i'm migrating to .net core 3.1, and I can't seem to get it to work. I've followed your example of setting it up, but I can't get a value in g-recaptcha-response
<input id="g-recaptcha-response" name="g-recaptcha-response" type="hidden" value="">
This is what i see when I inspect my html.@(Html.Recaptcha<RecaptchaV3HiddenInput>(RecaptchaSettings.Value));
The above is how I insert it it. It appears to correctly get the settings. Do you have any idea why this might happen?