{% extends "freeform/_layouts/settings" %}
{% import "_includes/forms" as forms %}
{% set title = "Captchas"|t("freeform") %}
{% block content %}
{{ redirectInput('freeform/settings/captchas') }}
{{ csrfInput() }}
{{ "Captcha Settings"|t('freeform') }}
{{ forms.lightswitchField({
first: true,
label: "Use Captchas on Forms?"|t('freeform'),
instructions: "Enable this to allow the use of reCAPTCHA or hCaptcha on your forms."|t('freeform'),
name: "settings[recaptchaEnabled]",
on: settings.recaptchaEnabled,
toggle: 'recaptcha-fields',
errors: settings.errors("recaptchaEnabled"),
}) }}
{% set isLite = not craft.freeform.pro %}
{% set opts = {
v2_checkbox: "reCAPTCHA v2 - Checkbox",
v2_invisible: {
label: "reCAPTCHA v2 - Invisible" ~ (isLite ? " (Pro Only)"),
disabled: isLite,
},
v3: {
label: "reCAPTCHA v3" ~ (isLite ? " (Pro Only)"),
disabled: isLite,
},
h_checkbox: {
label: "hCaptcha - Checkbox" ~ (isLite ? " (Pro Only)"),
disabled: isLite,
},
h_invisible: {
label: "hCaptcha - Invisible" ~ (isLite ? " (Pro Only)"),
disabled: isLite,
},
} %}
{{ forms.selectField({
label: "Captcha Type"|t('freeform'),
instructions: "Choose which Captcha service and type you want to use."|t('freeform'),
warning: "If using reCAPTCHA, please be sure the selection here matches the type on the Google reCAPTCHA site admin console and this site has been added to the approved Domains list."|t('freeform'),
id: "recaptcha-type",
name: "settings[recaptchaType]",
value: settings.recaptchaType,
errors: settings.errors("recaptchaType"),
options: opts,
}) }}
{{ forms.autosuggestField({
label: "Captcha Site Key"|t('freeform'),
name: "settings[recaptchaKey]",
required: true,
value: settings.recaptchaKey,
errors: settings.errors("recaptchaKey"),
suggestEnvVars: true,
}) }}
{{ forms.autosuggestField({
label: "Captcha Secret Key"|t('freeform'),
name: "settings[recaptchaSecret]",
required: true,
value: settings.recaptchaSecret,
errors: settings.errors("recaptchaSecret"),
suggestEnvVars: true,
}) }}
{{ "Behavior & Configuration"|t('freeform') }}
{{ forms.lightswitchField({
label: "Only load Captcha scripts once the user interacts with the form?"|t('freeform'),
instructions: "If you'd like to have the associated Captcha scripts load only once a user begins filling out the form, enable this setting. If you'd like your forms to be ready to go at page load, disable this setting."|t('freeform'),
name: "settings[recaptchaLazyLoad]",
on: settings.recaptchaLazyLoad,
errors: settings.errors("recaptchaLazyLoad"),
}) }}
{{ forms.selectField({
label: "Minimum Score"|t("freeform"),
instructions: "Enter the minimum score needed to pass the test. The higher the score, the more aggressive the protection will be. Setting this to '0.0' would allow almost all spam through, while '1.0' could potentially block legitimate users. We recommend a value of '0.5' to '0.7'."|t("freeform"),
name: "settings[recaptchaMinScore]",
value: settings.recaptchaMinScore,
errors: settings.errors("recaptchaMinScore"),
options: {
"0.0": "0.0",
"0.1": "0.1",
"0.2": "0.2",
"0.3": "0.3",
"0.4": "0.4",
"0.5": "0.5",
"0.6": "0.6",
"0.7": "0.7",
"0.8": "0.8",
"0.9": "0.9",
"1.0": "1.0",
}
}) }}