Users Manual

Required Configuration

  1. To use reCAPTCHA, you need to sign up for an API key pair (v2 and/or v3) for your site: http://www.google.com/recaptcha/admin

  2. Set your API key pair in TypoScript constants (v2 and/or v3) and the reCAPTCHA version (2 or 3):

 1plugin.tx_jhcaptcha.settings.reCaptcha {
 2    version =
 3    v2 {
 4        siteKey =
 5        secretKey =
 6    }
 7    v3 {
 8        siteKey =
 9        secretKey =
10    }
11}

Optional Configuration

 1plugin.tx_jhcaptcha.settings.reCaptcha {
 2    v2 {
 3        # Description: The color theme of the widget
 4        # Options: dark | light
 5        # Default: light
 6        theme = light
 7        # Description: The language of the widget
 8        # Options: https://developers.google.com/recaptcha/docs/language
 9        # Default: en
10        lang = en
11        # Description: The size of the widget
12        # Options: normal | compact
13        # Default: normal
14        size = normal
15    }
16    v3 {
17        # Description: Minimum Score (0.0 - 1.0)
18        # Default: 0.5
19        minimumScore = 0.5
20        # Description: See https://developers.google.com/recaptcha/docs/v3
21        action = homepage
22    }
23}

Usage in Form (EXT:form)

The reCAPTCHA can easy be used in the core extension form. The following steps are necessary:

Create a new field in your form reCAPTCHA (JhCaptchaRecaptcha) and save your form. Now the reCAPTCHA is ready!

Usage in powermail (EXT:powermail)

The reCAPTCHA can easy be used in the extension powermail. The following steps are necessary:

Note

Note that the usage has only been tested in the powermail versions 8.2 and 10.4! Most likely it will also work with other versions.

Create a new field in your form, set a title ("Captcha" for example) and select the type "reCAPTCHA (jh_captcha)". Now the reCAPTCHA is ready!

Usage in Formhandler (EXT:formhandler)

The reCAPTCHA can easy be used in the extension formhandler (Fork: phorax/formhandler for TYPO3 v10). The following steps are necessary:

1. Mastertemplate

First the captcha needs to be included in the master template. Example:

1<!-- ###master_spamprotection-jh_captcha_recaptcha### -->
2<div class="row">
3    <div class="large-12 columns">
4        ###jh_captcha_recaptcha###
5        ###error_jh_captcha_recaptcha###
6    </div>
7</div>
8<!-- ###master_spamprotection-jh_captcha_recaptcha### -->

2. Template

Now the marker can be used in the Form Template:

1###master_spamprotection-jh_captcha_recaptcha###

3. TypoScript

Then the validators need to be assigned to the captcha field:

1    [...]
2    validators.1.config.fieldConf {
3        jh_captcha_recaptcha.errorCheck {
4            1 = required
5            2 = \Haffner\JhCaptcha\Validation\ErrorCheck\ReCaptcha
6        }
7    }
8    [...]

4. Language file

Finally, the label and the error messages must be defined. Example:

1<label index="jh_captcha_recaptcha">reCAPTCHA</label>
2<label index="error_jh_captcha_recaptcha_required">reCAPTCHA is a mandatory field.</label>
3<label index="error_jh_captcha_recaptcha_recaptcha">reCAPTCHA validation error</label>

Now the reCAPTCHA is ready!