Normally, if you add the Recaptcha elemment to a form, you need to configure your the SiteKey and SecretKey for that element. If you have a lot of forms and each form needs to add a Recaptcha element, the configuration takes a lot of time and is difficult to manage.
For CMS 11:
There is a simpler way you can do it is to define the RecaptchaSecretKey and RecaptchaSiteKey appsetting in web.config.
<add key="RecaptchaSecretKey " value="YOUR_SECRET_KEY" />
<add key="RecaptchaSiteKey " value="YOUR_SITE_KEY" />
<add key="RecaptchaSiteKey " value="YOUR_SITE_KEY" />
For CMS 12:
You can enter the separate keys in appsettings.json in the EpiServer section:
"FormSamples": {
"FormSamplesApiKeyOptions": {
"AddressKey": {
"ClientApiKey": "YOUR_KEY",
"ServerApiKey": "YOUR_KEY"
},
"RecaptchaKey": {
"SiteKey": "YOUR_KEY",
"SecretKey": "YOUR_KEY"
}
}
}
Or set it in startup.cs
services.Configure<FormSamplesApiKeyOptions>(o => {
o.RecaptchaKey = new RecaptchaKey() {
SecretKey = "*****",
SiteKey = "*****"
};
});