Page 1 of 1

s01e05 - Google Recaptcha QUESTIONS/SUPPORT

Posted: Thu Mar 11, 2021 11:09 am
by admin
Questions/Support

Re: s01e05 - Google Recaptcha

Posted: Sat Jan 08, 2022 12:51 pm
by zeeshop
Hi,
Since installing this getting the below error on Create account page, and not creating an account:
Same for COntact us page/ not sending messages:
Notice: Undefined index: error-codes in /homepages/31/*********/htdocs/*********/includes/hooks/shop/siteWide/addRecaptcha.php on line 52

Notice: Trying to access array offset on value of type null in /homepages/31/*********/htdocs/*********/includes/hooks/shop/siteWide/addRecaptcha.php on line 52

Warning: constant(): Couldn't find constant in /homepages/31/*********/htdocs/*********/includes/hooks/shop/siteWide/addRecaptcha.php on line 52
Reffered Line 52 is as below:

Code: Select all

  $GLOBALS['messageStack']->add('header', constant($result['error-codes'][0]), 'error');
Thanks

Re: s01e05 - Google Recaptcha

Posted: Sat Jan 08, 2022 2:17 pm
by ecartz
zeeshop wrote: Sat Jan 08, 2022 12:51 pm

Code: Select all

  $GLOBALS['messageStack']->add('header', constant($result['error-codes'][0]), 'error');
You could change that line to

Code: Select all

  $GLOBALS['messageStack']->add('header', isset($result['error-codes'][0]) ? constant($result['error-codes'][0]) : $curlData, 'error');
It will still be broken, but it may give a more useful error message. That it's reaching that line at all means something is broken. Make sure that you've followed all the installation instructions from the README.md file. In particular, make sure that you have edited

Code: Select all

  public $_sitekey = '';
  public $_secret  = '';
to have the right values.

Re: s01e05 - Google Recaptcha

Posted: Sat Jan 08, 2022 3:32 pm
by zeeshop
Thanks @ecartz

After editing to the suggestion getting below message:
{ "success": true, "challenge_ts": "2022-01-08T15:30:01Z", "hostname": "www.mysite.com" }
Message not sent/ or account not created.
I have followed the instructions and entered the site/ secret key as required.

Re: s01e05 - Google Recaptcha

Posted: Sat Jan 08, 2022 4:30 pm
by ecartz
You could try changing this line:

Code: Select all

      if ($result['success'] === 'true') {
to

Code: Select all

      if ($result['success'] === true) {
(Remove two apostrophes around true.)

If that doesn't work, before the messageStack line, try adding

Code: Select all

var_dump($result);exit();
That will really break it, but hopefully give useful feedback.

Re: s01e05 - Google Recaptcha

Posted: Sat Jan 08, 2022 4:58 pm
by zeeshop
The last change fixed the issue.

Another thing I am noticing is when the box for Recaptcha is not ticked the warning is coming as below.
Box not ticked.JPG
Seems like the message from the language file is not triggering/ appearing as required.

Language file is showing:

Code: Select all

define('missing-input-response', 'We cannot detect a Recaptcha - did you tick the box?');
define('invalid-input-response', 'Sorry, something has gone wrong with Recaptcha, please email us instead.');

define('missing-input-secret', 'Recaptcha: Missing Secret');
define('invalid-input-secret', 'Recaptcha: Invalid Secret');


Many Thanks

Re: s01e05 - Google Recaptcha

Posted: Tue Feb 13, 2024 8:03 pm
by tessthepup
Hi Guys,

Just wondering if anyone is using this on a 1.0.8.20 store as I am having an issue.

The contact us form submits without the recaptcha ticked box being ticked :?

Thanks

Mark