reCaptcha not showing and/or invalid captcha code in Joomla?
Over the last few days (November 2013) some users of Joomla 2.5 and Joomla 3.2 have noticed a recurring error when they are use the default ReCaptcha plugin. The form doesn’t show the default ReCaptcha box on the Contact view page, on the Registration page or even the GK Contact plugin.
Looking through the online google documentation, we noticed that the API library location (URL) changed. In the following article we will show you how to fix it without waiting for an official patch/update for the Joomla! CMS.
IMPORTANT NOTE! This bug have been fixed with update Joomla 2.5.17 and Joomla! 3.2.1 – please update your Joomla! Version as soon as possible.
The First step, before doing anything else please make sure you’re using the correct keys. Are your public and private keys swapped?
On the reCAPTCHA configuration webpage we suggest you create a global key by checking the box for “Enable this key on all domains (global key)”. If this option is checked, the keys will work on your test.joo.com, test2.joo.com, y.com and any other domains or sub-domains.
Second step, you have to modify one line of code in the recaptcha.php file located in: Plugins –> Captcha –> Recaptcha folder.
const RECAPTCHA_API_SERVER = "http://api.recaptcha.net"; const RECAPTCHA_VERIFY_SERVER = "api-verify.recaptcha.net";
Change to:
const RECAPTCHA_API_SERVER = "http://www.google.com/recaptcha/api"; const RECAPTCHA_VERIFY_SERVER = "www.google.com";
As you can see there is a different URL in the first line. But depends of Joomla version there are few others small changes in this file. That’s why we have prepared a fix – just download, unzip and replace the file using FTP/SFTP.
Download Fix (only for J2.5) –> recaptcha_j25
Download Fix (only for J3.2) –> recaptcha_for_j3
After file replace all forms again will be secured with a reCAPTCHA and you should not encounter the issue anymore.
Official information about changes:
- Changes for Joomla! 2.5 : https://github.com/joomla/joomla-cms/pull/2438/files
- Changes for Joomla! 3.2 : https://github.com/joomla/joomla-cms/pull/2437/files
Recaptcha and other CMS’s
If you’re using a different CMS, you can search in the code for the API library:
<script type="text/javascript" src="https://api.recaptcha.net/js/recaptcha_ajax.js"></ script>
Change it to the new location:
<script type="text/javascript" src="https://www.google.com/recaptcha/api/js/recaptcha_ajax.js"> </script>
Recaptcha and CSS issues
Sometimes you may also encounter issues with CSS; in this case the following code is rather useful:
#recaptcha_area input { height: auto; } #recaptcha_area a { font-weight: normal; }
This article was first published