{# @var craft \craft\web\twig\variables\CraftVariable #}
{#
/**
 * craft-recaptcha plugin for Craft CMS
 *
 * craft-recaptcha Settings.twig
 *
 * @author    Cédric Givord
 * @copyright Copyright (c) Cédric Givord
 * @link      https://c10d.dev
 * @package   CraftRecaptcha
 * @since     1.0.0
 */
#}

{% import "_includes/forms" as forms %}

{{ forms.autosuggestField({
    label: 'Site Key'|t('craft-recaptcha'),
    instructions: 'Enter your reCAPTCHA site key.'|t('craft-recaptcha'),
    id: 'siteKey',
    name: 'siteKey',
    value: settings['siteKey'],
    required: true,
    suggestEnvVars: true
  })
}}

{{ forms.autosuggestField({
    label: 'Secret Key'|t('craft-recaptcha'),
    instructions: 'Enter your reCAPTCHA secret key.'|t('craft-recaptcha'),
    id: 'secretKey',
    name: 'secretKey',
    value: settings['secretKey'],
    required: true,
    suggestEnvVars: true
  })
}}

{{ forms.selectField({
    label: 'Threshold'|t('craft-recaptcha'),
    instructions: 'Enter your reCAPTCHA threshold preference.'|t('craft-recaptcha'),
    id: 'threshold',
    name: 'threshold',
    value: settings['threshold'],
    options: [
      { value: '0.0', label: '0.0' },
      { value: '0.1', label: '0.1' },
      { value: '0.2', label: '0.2' },
      { value: '0.3', label: '0.3' },
      { value: '0.4', label: '0.4' },
      { value: '0.5', label: '0.5' },
      { value: '0.6', label: '0.6' },
      { value: '0.7', label: '0.7' },
      { value: '0.8', label: '0.8' },
      { value: '0.9', label: '0.9' },
      { value: '1.0', label: '1.0' }
    ]
}) }}

<hr>

{{ forms.lightswitchField({
    label: 'Validate contact forms?'|t('craft-recaptcha'),
    instructions: 'Enable to automatically validate reCAPTCHAs when using the official [Craft CMS contact form plugin](https://github.com/craftcms/contact-form).'|t('craft-recaptcha'),
    id: 'validateContactForm',
    name: 'validateContactForm',
    on: settings['validateContactForm']
  })
}}

{{ forms.lightswitchField({
    label: 'Validate users registration?'|t('craft-recaptcha'),
    instructions: 'Enable to automatically validate reCAPTCHAs when using public users registration.'|t('craft-recaptcha'),
    id: 'validateUsersRegistration',
    name: 'validateUsersRegistration',
    on: settings['validateUsersRegistration']
  })
}}
