Datamanager 2 recaptcha widget

Uses the reCaptcha service to provide Captcha authentification to a form.

The captcha is completely auto-generated, you should not have to worry about any defaults. The captcha rendering is done by external service. reCaptcha uses it's service for digitizing old books.

Security considerations: reCaptcha is valid for only one post. If host reloads a page a new reCaptha is created

Available configuration options:

Integration Guide:

Integrating Captcha support does not need any changes to your components, you just have to add a new field into your DM2 schema using the recaptcha type/widget with null storage:

'recaptcha' => Array
(
    'title' => 'User Verification',
    'storage' => null,
    'type' => 'recaptcha',
    'widget' => 'recaptcha',
),

reCaptcha is configured by setting private and public keys to snippet sitegroup-config/midcom.helper.datamanager2/config

'recaptcha_privkey' => 'get key from recaptcha.org',
'recaptcha_pubkey' => 'get key from recaptcha.org',
package midcom.helper.datamanager2

 Methods

_on_initialize ()

The initialization event handler creates the captcha passphrase (if necessary).

Returns

booleanIndicating Success

add_elements_to_form ($attributes)

Adds a simple single-line text form element at this time.

Parameters

$attributes

freeze ()

Freezes the Input Element

is_frozen ()

Checks if the input element is frozen.

sync_type_with_widget ($results)

Parameters

$results

unfreeze ()

Unfreezes the Input Element

validate ($fields)

QF Valiation callback which verifies the passcode against the Captcha.

Parameters

$fields

 Properties

 

mixed $_private_key

 

mixed $_public_key

Public and private keys used by recaptcha TODO: These could come from configuration
 

mixed $_validated

 

\HTML_QuickForm_Element $_element

The input textbox used which needs to be frozen when operating on the captcha.