alancaptcha/neos-form

Neos captcha widget

Installs: 4

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 2

Forks: 0

Open Issues: 0

Type:neos-package

1.0.0 2025-02-05 13:49 UTC

This package is not auto-updated.

Last update: 2025-02-05 15:24:39 UTC


README

Neos plugin to integrate AlanCaptcha into Forms. The following form integrations are supported:

  • Neos.Form
  • Neos.Form.Builder
  • Neos.Fusion.From

Installation

Require the package using composer:

composer require alancaptcha/neos-form

Create an account on the AlanCaptcha Admin Panel and get your Site key and Api key. This is further explained in the AlanCaptcha documentation.

Usage with Neos.Form

Just add the new form element to your form definition renderables:

label: 'MyLabel'
identifier: myForm
type: 'Neos.Form:Form'
renderables:
  -
    type: 'Neos.Form:Page'
    identifier: page-one
    renderables:
      -
        type: 'Alan.NeosForm:Captcha'
        identifier: captcha
        label: 'Alan Captcha'
        properties:
            apiKey: 'API_KEY'
            siteKey: 'SITE_KEY'
            monitorTag: 'MONITOR_TAG (optional)'
            unverifiedtext: '<<Unverified>>'
            verifiedtext: '<<Verified>>'
            retrytext: '<<Retry>>'
            workingtext: '<<Working...'
            starttext: '<<Start>>'
finishers:
  -
    <Your finishers here>

The text properties are optional and can be used to customize the text of the captcha element.

Usage with Neos.Form.Builder

Add the AlanCaptcha form element to your form: AlanCaptcha Form Element Configure the element with your AlanCaptcha Api key and Site key.

Usage with Neos.Fusion.Form

Add a FieldContainer with the Alan.NeosForm:FusionForm.Captcha element to your form:

<Neos.Fusion.Form:FieldContainer field.name="captcha">
    <Alan.NeosForm:FusionForm.Captcha siteKey="SITE_KEY" />
</Neos.Fusion.Form:FieldContainer>

Set the field name based on our needs, but make sure to use the same field name in the schema (see below).

The following options are available:

  • siteKey (required): The AlanCaptcha Site Key.
  • monitorTag (optional): The AlanCaptcha Monitor Tag to use.
  • lang.unverifiedtext (optional): The AlanCaptcha Monitor Tag to use.
  • lang.verifiedtext (optional)
  • lang.retrytext (optional)
  • lang.workingtext (optional)
  • lang.starttext (optional)

Then, add the field to the schema and configure the Validator:

captcha = ${Form.Schema.string().validator('Alan.NeosForm:IsValid', {apiKey: 'API_KEY', errorMessage: 'The Alan Captcha check failed. Try submitting the form again.'})}

Make sure that the key (e.g. captcha) matches the key in the FieldContainer (see above).

The following options are available:

  • apiKey (required): The AlanCaptcha Api Key.
  • errorMessage: Use this to override the error message in case of a failed captcha check.