tanveery / recaptcha-net

reCAPTCHA for .NET library lets you easily use Google's reCAPTCHA in an ASP.NET Web Forms / MVC / ASP.NET Core application.
Apache License 2.0
161 stars 68 forks source link

Add support for Razor Pages in netcoreapp-3.1 #58

Closed cmjdiff closed 1 year ago

cmjdiff commented 3 years ago

Currently this cannot be used in Razor Pages (e.g. the built-in ASP.NET Core Identity default pages) as the only public way of getting a RecaptchaVerificationHelper is an extension method on System.Web.Mvc.Controller since the constructor is declared internal.

This provides extension methods on Microsoft.AspNetCore.Mvc.RazorPages.PageModel which should require no changes to the example code, other than to mention that it (probably) goes in PageModel.OnPostAsync rather than a controller method decorated with HttpPost.