Jump to content

Google reCaptcha possible update?


chuliano

Recommended Posts

Hello, I'm working on a recaptcha upgrade: google recaptcha V2
 
 
OK
 
edit the "recaptchalib.php" file in: "includeslibrecaptcha" in line 97 aprox
 
function recaptcha_get_html ($pubkey, $error = null, $use_ssl = false)
{
	if ($pubkey == null || $pubkey == '') {
		die ("To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>");
	}
	
	if ($use_ssl) {
                $server = RECAPTCHA_API_SECURE_SERVER;
        } else {
                $server = RECAPTCHA_API_SERVER;
        }

        $errorpart = "";
        if ($error) {
           $errorpart = "&amp;error=" . $error;
        }
        /*return '<script type="text/javascript" src="'. $server . '/challenge?k=' . $pubkey . $errorpart . '"></script>

	<noscript>
  		<iframe src="'. $server . '/noscript?k=' . $pubkey . $errorpart . '" height="300" width="500" frameborder="0"></iframe><br/>
  		<textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
  		<input type="hidden" name="recaptcha_response_field" value="manual_challenge"/>
	</noscript>';*/
	
	return '
		<div class="g-recaptcha" data-sitekey="MY_KEY(change my key)"></div>
<noscript>
  <div style="width: 302px; height: 352px;">
    <div style="width: 302px; height: 352px; position: relative;">
      <div style="width: 302px; height: 352px; position: absolute;">
        <iframe src="https://www.google.com/recaptcha/api/fallback?k=MY_KEY(change my key)"
                frameborder="0" scrolling="no"
                style="width: 302px; height:352px; border-style: none;">
        </iframe>
      </div>
      <div style="width: 250px; height: 80px; position: absolute; border-style: none;
                  bottom: 21px; left: 25px; margin: 0px; padding: 0px; right: 25px;">
        <textarea id="g-recaptcha-response" name="g-recaptcha-response"
                  class="g-recaptcha-response"
                  style="width: 250px; height: 80px; border: 1px solid #c1c1c1;
                         margin: 0px; padding: 0px; resize: none;" value="">
        </textarea>
      </div>
    </div>
  </div>
</noscript>';
	
}

 

edit "controllercontroller.index.inc.php" in line 62 aprox
 
	$GLOBALS['recaptcha_keys'] = array('captcha_private' => 'MY_NEW_KEY_PRIV', 'captcha_public' => 'MY_NEW_KEY_PUB');

 
 
and also this one in the "skin" folder:  "templatecontent.recaptcha.php"
 
change everything for this code
 
{if $RECAPTCHA}
<fieldset id="recaptcha-title">
<legend>{$LANG.form.verify_human}</legend>
{$DISPLAY_RECAPTCHA}
</fieldset>
{/if}

BUT... show the same error text
 
"The verification code was incorrect. Please try again."
 
Anyone know if this is possible to update or can not?
 

 

 

 

Link to comment
Share on other sites

Please examine the actual HTML as shown in your browser. This may be a case where the new code is not getting rendered in the template because CubeCart is using a cached copy of the template.

 

If the browser's Show Source reveals that the page is still using the stock reCaptcha, then in admin, Maintenance, Rebuild tab, Clear the cache.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...