reCAPTCHA v2

ExpressionEngine Addon

Version: 1.0.2
Author url: http://eecoding.com/
3rd Party (Commercial)


This addon replaces the built-in ExpressionEngine captcha to Google reCAPTCHA v2.

Supported EE forms:

To use reCAPTCHA, you need to sign up on Google and receive API key pair for your site. The key pair consists of a site key and secret. For more details read below: https://developers.google.com/recaptcha/docs/start

AJAX contents support

You can generate reCAPTCHA for dynamic loaded forms,
Simply apply the function as shown below:

$("#my_dynamic_form").load('/my_dynamic_form', function(){
	document.reCAPTCHAv2(
		$(this).find('.g-recaptcha')
	);
});

Now you have reCAPTCHAv2_init event (for jQuery only):

$(document).on('reCAPTCHAv2_init', function(){
	// your code
});

Installation for ExpressionEngine v2.x

  1. Upload the recaptchav2 folder to system/expressionengine/third_party
  2. Enable and configure the extension via Add-Ons > Extensions
  3. Remove the hard-coded CAPTCHA input field from your member registration template (../themes/profile_themes/[theme_name]/registration_form.html) and any comment submission form templates so that the CAPTCHA's conditional block looks like:
{if captcha}
    {captcha}
{/if}

Installation for ExpressionEngine v3.x

  1. Upload the recaptchav2 folder to system/user/addons
  2. Enable and configure the extension via Developer > Add-On Manager
  3. Remove the hard-coded CAPTCHA input field from your member registration template (../themes/ee/member/[theme_name]/registration_form.html) and any comment submission form templates so that the CAPTCHA's conditional block looks like:
{if captcha}
    {captcha}
{/if}

Global variables

F.A.Q.

Can I use this with the MSM?
It should work as long as you use a Global key by ticking Enable this key on all domains (global key) when you create your reCAPTCHA key.

I keep getting "Unable to receive your comment at this time." when testing the comment submission form?
If you’re testing with the same comment text, EE is likely enforcing spam protection and/or throttling your post. Test with unique comments or adjust the settings at:

I specified in the auto append settings "Add before closing tag ", but the script is not added and I see the error "document.reCAPTCHAv2 is not a function" (or there are no errors at all)
Most likely you defined a closing tag in global variables, which caused an error. You can also try to add the main script manually using the global variable {recaptcha:script} and change auto append setting to "Do not add script (manual variant)"


Notes and Warnings

!!!Attention, in version 1.0.2, the logic of initialization of captcha has been changed! Now the main script will be added at the user's choice:

Also, note that automatically the script will be inserted in all cases, except when the closing tags are defined in global variables. For example, if you select "Add before closing tag </head>" and you have a global variable {html_head} where you defined the closing tag "</head>" - then the script will not be added


Changelog

1.0.2 (2018/01/26)

1.0.1 (2016/09/14)

1.0