Skip to content

Commit

Permalink
Fixed broken recaptcha urls
Browse files Browse the repository at this point in the history
  • Loading branch information
SniperSister committed Nov 7, 2013
1 parent ffcfba0 commit 01e3c84
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions plugins/captcha/recaptcha/recaptcha.php
Expand Up @@ -19,9 +19,9 @@
*/
class PlgCaptchaRecaptcha extends JPlugin
{
const RECAPTCHA_API_SERVER = "http://api.recaptcha.net";
const RECAPTCHA_API_SERVER = "http://www.google.com/recaptcha/api";
const RECAPTCHA_API_SECURE_SERVER = "https://www.google.com/recaptcha/api";
const RECAPTCHA_VERIFY_SERVER = "api-verify.recaptcha.net";
const RECAPTCHA_VERIFY_SERVER = "www.google.com";

/**
* Load the language file on instantiation.
Expand Down Expand Up @@ -126,7 +126,7 @@ public function onCheckAnswer($code)
}

$response = $this->_recaptcha_http_post(
self::RECAPTCHA_VERIFY_SERVER, "/verify",
self::RECAPTCHA_VERIFY_SERVER, "/recaptcha/api/verify",
array(
'privatekey' => $privatekey,
'remoteip' => $remoteip,
Expand Down

8 comments on commit 01e3c84

@carlitorweb
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@mixerp2
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@hbagheri
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ّI have changed all. but captcha do not accept !

@mehdiyazdani
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@oxnxo
Copy link

@oxnxo oxnxo commented on 01e3c84 Aug 25, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice. Works perfectly!

@adcp
Copy link

@adcp adcp commented on 01e3c84 Apr 13, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use Joomla 2.5.7 and it's work!. Thanks!.

@toneeedotcom
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code is written differently in Joomla! 3.4.3. The URLs referenced in plugins/captcha/recaptcha/recaptcha.php are indeed correct, but the reCAPTCHA plugin fails to insert the proper JavaScript into the document head. See below:

class PlgCaptchaRecaptcha extends JPlugin
{
/**
* Load the language file on instantiation.
*
* @var boolean
* @SInCE 3.1
*/
protected $autoloadLanguage = true;

/**
 * Initialise the captcha
 *
 * @param   string  $id  The id of the field.
 *
 * @return  Boolean True on success, false otherwise
 *
 * @throws  Exception
 *
 * @since  2.5
 */
public function onInit($id = 'dynamic_recaptcha_1')
{
    $document = JFactory::getDocument();
    $app      = JFactory::getApplication();

    JHtml::_('jquery.framework');

    $lang       = $this->_getLanguage();
    $version    = $this->params->get('version', '1.0');
    $pubkey     = $this->params->get('public_key', '');

    if ($pubkey == null || $pubkey == '')
    {
        throw new Exception(JText::_('PLG_RECAPTCHA_ERROR_NO_PUBLIC_KEY'));
    }

    switch ($version)
    {
        case '1.0':
            $theme = $this->params->get('theme', 'clean');

            $file = $app->isSSLConnection() ? 'https' : 'http';
            $file .= '://www.google.com/recaptcha/api/js/recaptcha_ajax.js';
            JHtml::_('script', $file);

            $document->addScriptDeclaration('jQuery( document ).ready(function()
            {
                Recaptcha.create("' . $pubkey . '", "' . $id . '", {theme: "' . $theme . '",' . $lang . 'tabindex: 0});});'
            );
            break;
        case '2.0':
            $theme = $this->params->get('theme2', 'light');

            $file = $app->isSSLConnection() ? 'https' : 'http';
            $file .= '://www.google.com/recaptcha/api.js?hl=' . JFactory::getLanguage()
                    ->getTag() . '&render=explicit';

            JHtml::_('script', $file, true, true);

            $document->addScriptDeclaration('jQuery(document).ready(function($) {$(window).load(function() {'
                . 'grecaptcha.render("' . $id . '", {sitekey: "' . $pubkey . '", theme: "' . $theme . '"});'
                . '});});'
            );
            break;
    }

    return true;
}

@yimilan
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tengo un problema con recaptcha en la versión de joomla 3.7 y el modulo K2 al configurarlo me lanza un mensaje que todos los campos deben estar llenos y todos lo estan.

Please sign in to comment.