Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 228 Vote(s) - 3.62 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Prestashop - AuthController.php is not receiving input values

#1
I'm trying to add google reCaptcha to prestashop's opc registration page, I have the checkbox setup and it's working however the php file is not receiving the captcha response. Let me explain. Here's what I've done so far: In my header.tpl I added

<script src='https://www.google.com/recaptcha/api.js'></script>
In order-opc-new-account.tpl, I added

<div class="g-recaptcha" data-sitekey="[my_public_key]"></div>
In my AuthController.php I added

if (Tools::isSubmit('submitAccount') OR Tools::isSubmit('submitGuestAccount')) //if statement was already present
{
// captcha code I added
$reCaptchaUrl='https://www.google.com/recaptcha/api/siteverify';
$reCaptchaSecret = '[my_secret_key]';
$reCaptchaResponse = $_POST['g-recaptcha-response'];
$ip = $_SERVER['REMOTE_ADDR'];

$verifyCaptcha = file_get_contents($reCaptchaUrl."?secret=".$reCaptchaSecret."&response=".$reCaptchaResponse."&remoteip=".$ip);
$captchaReply = json_decode($verifyCaptcha);

if(isset($captchaReply->success) AND $captchaReply->success == true){
$logger = new FileLogger(0);
$logger->setFilename(_PS_ROOT_DIR_."/log/debug.log");
$logger->logDebug("Captcha was successful: ".$reCaptchaResponse);
} else {
//captcha failed
$logger = new FileLogger(0);
$logger->setFilename(_PS_ROOT_DIR_."/log/debug.log");
$logger->logDebug("Captcha failed: ".$reCaptchaResponse);
}

// ... prestashop registration code
}

I learned with the debugging messages that `$reCaptchaResponse` variable is actually coming empty everytime, even if the captcha has been checked. Any ideas why?

**Edit**: The form actually sends the data to `authentication.php` which has the following lines

require(dirname(__FILE__).'/config/config.inc.php');
ControllerFactory::getController('AuthController')->run();
My guess is that this piece of code *forwards* the form data to `AuthController.php` but it only forwards fields that it's been told to forward. It does not recognizes the new recaptcha field and doesn't forward that data to the file. So I would need to find who decides which data get's forwarded.
Reply

#2
Make sure `<div class="g-recaptcha" data-sitekey="6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI"></div>` is in the FORM element.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through