jbennecker / silverstripe-recaptcha
SilverStripe module for ReCaptcha 2.0 spam protection
Installs: 2 634
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:silverstripe-vendormodule
Requires
- php: >=7.0.0
- silverstripe/cms: ^4
- silverstripe/framework: ^4
This package is auto-updated.
Last update: 2022-03-17 07:42:11 UTC
README
Introduction
This module adds a RecaptchaField to SilverStripe 4.x, which you can use in custom forms.
Install
composer require jbennecker/silverstripe-recaptcha
Usage
Put your keys in app/_config/app.yml
jbennecker\recaptcha\Forms\RecaptchaField: public_api_key: "public key" private_api_key: "private key"
Then you can use the Field in your forms.
public function HelloForm() { $fields = new FieldList( TextField::create('Name', _t('HelloForm.Name', 'Name')), TextField::create('Email', _t('HelloForm.Email', 'E-Mail')), TextareaField::create('Nachricht', _t('HelloForm.Nachricht', 'Nachricht')), RecaptchaField::create('recaptcha') // <--- add this ); $actions = new FieldList( FormAction::create('doSayHello')->setTitle(_t('HelloForm.Submit', 'Senden')) ); $required = new RequiredFields('Name', 'Email', 'Nachricht'); $form = new Form($this, 'HelloForm', $fields, $actions, $required); return $form; }