The following article describes how to create a custom CAPTCHA widget using Google reCAPTCHA v2 or v3. This is a forms widget and you can place it in a form. For more information, see Create and design forms.
Before implementing the widget, you must configure Sitefinity CMS. Perform the following:
NOTE: The version of the reCAPTCHA configuration for the secret key must correspond to the version of the reCAPTCHA widget that you are creating.
You create the widget’s ViewComponent in the Renderer application. Perform the following:
ViewComponent
reCAPTCHA v2
reCAPTCHA v3
You create the widget’s View in the Renderer application. Perform the following:
View
Views/Shared/Components/Captcha2
Views/Shared/Components/Captcha3
Captcha2
Captcha3
You create the widget’s script in the Renderer application. Perform the following:
Scripts
NOTE: In the code samples above, change the <Captcha V2 site key> or <Captcha V3 site key> with the actual site key from the configured API key pair.
<Captcha V2 site key>
<Captcha V3 site key>
RESULT: After you build the project, the widget is displayed inside the forms widget selector when you are editing or creating ASP.NET Core forms.
This sample is available in Sitefinity’s GitHub repository. You can run and play with it. To do this, perform the following:
sitefinity-aspnetcore-mvc-samples-master/src/captcha
captcha.sln
appsettings.json
“Sitefinity”
“Url”
captcha
Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.
This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.
This free lesson teaches administrators the basics about protecting yor Sitefinity instance and its sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.
The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.
To submit feedback, please update your cookie settings and allow the usage of Functional cookies.
Your feedback about this content is important