Difference between revisions of "Recaptcha3 field"

From EPrints Documentation
Jump to: navigation, search
(Added Recaptcha3 page)
 
m
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
{{fieldtypes}}
 
{{fieldtypes}}
 +
  
 
== Description ==
 
== Description ==
 +
Allows a Captcha using [https://developers.google.com/recaptcha/docs/v3 Google's reCAPTCHAv3 service] to be added to a form to protect it from being spammed by bots.
 +
 
Add the following configuration to a file called <code>cfg/cfg.d/recaptcha3.pl</code> in your archive, if it does not already exist.
 
Add the following configuration to a file called <code>cfg/cfg.d/recaptcha3.pl</code> in your archive, if it does not already exist.
 
  $c->{recaptcha3}->{private_key} = "CHANGEME";
 
  $c->{recaptcha3}->{private_key} = "CHANGEME";
Line 7: Line 10:
 
  $c->{recaptcha3}->{min_score} = 0.5;
 
  $c->{recaptcha3}->{min_score} = 0.5;
  
This field uses the Google "reCAPTCHAv3" 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 and public key (also known by Google as a secret key and site key respectively) for the above configuration, this can be done via the '''reCAPTCHA Admin Console''' linked form https://developers.google.com/recaptcha/docs/v3. If you are setting up a Recaptcha3 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.
+
As this field uses the Google's reCAPTCHAv3 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 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 '''Score based (v3)''' option when registering.  
 +
 
 +
If you are setting up a Recaptcha3 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.
 
  $c->add_dataset_field( "request", {
 
  $c->add_dataset_field( "request", {
 
   name => "captcha",
 
   name => "captcha",
Line 13: Line 18:
 
   type => "recaptcha3",
 
   type => "recaptcha3",
 
  });
 
  });
 +
 +
If you find you are still getting spam from the form to which you have applied a Recaptcha3 field, then try increasing <code>$c->{recaptcha3}->{min_score}</code> to a higher value such as <code>0.7</code>.
  
 
== Inheritance ==
 
== Inheritance ==

Latest revision as of 08:33, 21 July 2024

EPrints 3 Reference: Directory Structure - Metadata Fields - Repository Configuration - XML Config Files - XML Export Format - EPrints data structure - Core API - Data Objects


Metadata Fields: Arclanguage - Base64 - Bigint - Boolean - Compound - Counter - Dataobjref - Date - Decimal - Email - Fields - Float - Id - Idci - Image - Int - Itemref - Keywords - Langid - Longtext - Longtext_counter - Multilang - Multipart - Name - Namedset - Pagerange - Recaptcha - Recaptcha3 - Relation - Search - Secret - Set - Storable - Subject - Subobject - Text - Time - Timestamp - Url - Uuid


Description

Allows a Captcha using Google's reCAPTCHAv3 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/recaptcha3.pl in your archive, if it does not already exist.

$c->{recaptcha3}->{private_key} = "CHANGEME";
$c->{recaptcha3}->{public_key} = "CHANGEME";
$c->{recaptcha3}->{min_score} = 0.5;

As this field uses the Google's reCAPTCHAv3 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 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 Score based (v3) option when registering.

If you are setting up a Recaptcha3 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 => "recaptcha3",
});

If you find you are still getting spam from the form to which you have applied a Recaptcha3 field, then try increasing $c->{recaptcha3}->{min_score} to a higher value such as 0.7.

Inheritance

Additional Properties

As for Id fields.

Required Phrases

validate:recaptcha3_mismatch - Phrase to display if reCAPTCHAv3 submission errored in some way.

Database

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

API

See API page.

Examples

Most basic example.

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