⧼vector-jumptocontent⧽

Recaptcha field: Difference between revisions

From EPrints Documentation
Improved description
mNo edit summary
 
Line 9: Line 9:
  $c->{recaptcha}->{public_key} = "CHANGEME";
  $c->{recaptcha}->{public_key} = "CHANGEME";


As this field uses the Google's reCAPTCHAv2 service and renders a Captcha, (a test that humans can easily pass, but robots shouldn't be able to), you will need to use a Google account to generate a private key and public key (also known by Google as a '''secret key''' and '''site key''' respectively) for the above configuration.  This can be done via Google's '''[https://www.google.com/recaptcha/admin/create Site Registration Tool]'''.  By sure to use version 2 (reCAPTCHAv2) when registering.
As this field uses the Google's reCAPTCHAv2 service and renders a Captcha, (a test that humans can easily pass, but robots shouldn't be able to), you will need to use a Google account to generate a private key and public key (also known by Google as a '''secret key''' and '''site key''' respectively) for the above configuration.  This can be done via Google's '''[https://www.google.com/recaptcha/admin/create Site Registration Tool]'''.  By sure to use '''Challenge (v2)''' option when registering.


If you are setting up a Recaptcha field for protecting request copy forms, you will need to add the following configuration to a file in your archive's <code>cfg/cfg.d/</code> directory.
If you are setting up a Recaptcha field for protecting request copy forms, you will need to add the following configuration to a file in your archive's <code>cfg/cfg.d/</code> directory.

Latest revision as of 08:32, 21 July 2024


Description

Allows a Captcha using Google's reCAPTCHAv2 service to be added to a form to protect it from being spammed by bots.

Add the following configuration to a file called cfg/cfg.d/recaptcha.pl in your archive, if it does not already exist.

$c->{recaptcha}->{private_key} = "CHANGEME";
$c->{recaptcha}->{public_key} = "CHANGEME";

As this field uses the Google's reCAPTCHAv2 service and renders a Captcha, (a test that humans can easily pass, but robots shouldn't be able to), you will need to use a Google account to generate a private key and public key (also known by Google as a secret key and site key respectively) for the above configuration. This can be done via Google's Site Registration Tool. By sure to use Challenge (v2) option when registering.

If you are setting up a Recaptcha field for protecting request copy forms, you will need to add the following configuration to a file in your archive's cfg/cfg.d/ directory.

$c->add_dataset_field( "request", {
  name => "captcha",
  replace_core => 1,
  type => "recaptcha",
});

Inheritance

Additional Properties

As for Id fields.

Required Phrases

validate:recaptcha_mismatch - Phrase to display if reCAPTCHA submission errored in some way.

Database

Recaptcha fields are not stored in the database they are just so reCAPTCHA can be added to certain forms. The result of the reCAPTCHA does not need to be stored.

API

See API page.

Examples

Most basic example.

{
    name => 'captcha',
    type => 'recaptcha',
}