Error ReCaptcha V2

Forum dedicated to Mods for HESK created by Mike Koch

Moderator: mkoch227

Post Reply
bastiaan.c
Posts: 142
Joined: Sat Jun 22, 2013 9:24 pm

Error ReCaptcha V2

Post by bastiaan.c »

Hi, I do not understand how to use the ReCaptcha V2

Google give me a Site key and a Secret key
MFH is asking for Public key and a Private key

Image

Image

Image
What do I do wrong?

Thanks
mkoch227
Posts: 666
Joined: Wed Jul 04, 2012 3:37 pm

Re: Error ReCaptcha V2

Post by mkoch227 »

Site key = Public Key
Secret Key = Private Key

In HESK, copy and paste the value shown under "site key" into the public key field and enter the value under "secret key" into the private key field. Also ensure that the reCAPTCHA created is set to the same TLD as your helpdesk's TLD (for example, if you helpdesk is at http://www.example.com/helpdesk, your TLD for your reCAPTCHA should be http://www.example.com)
Mike, Lead Developer of Image HESK: A surprisingly simple, user-friendly and FREE help desk software with integrated knowledgebase.
bastiaan.c
Posts: 142
Joined: Sat Jun 22, 2013 9:24 pm

Re: Error ReCaptcha V2

Post by bastiaan.c »

Hi Mike, I tested all you wrote very precise and it did not help yet :-(

BTW I am not allowed to fill in this at Google: www.example.com/support

Although it says a green V it says:

Code: Select all

 Error: Please correct the following errors:

    Incorrect SPAM Prevention answer, please try again.
after submitting
Hairball
Posts: 4
Joined: Sat Nov 01, 2014 1:26 am

Re: Error ReCaptcha V2

Post by Hairball »

I'm having exactly the same issue.

Are you behind a proxy or firewall or something blocking?
I cant see anything in my apache logs that would point to an issue.

I'd really like to implement v2 but cant get past this issue.
mkoch227
Posts: 666
Joined: Wed Jul 04, 2012 3:37 pm

Re: Error ReCaptcha V2

Post by mkoch227 »

Some users have issues since the v2 ReCaptcha lib that is included in HESK only supports file_get_contents, which is restricted in some PHP installations. A workaround that is planned to be included in HESK v2.4.0 is to add cURL support. You can try downloading this version of recaptchalib_v2.php at https://raw.githubusercontent.com/mkoch ... lib_v2.php and replace your existing file, which is located at /inc/recaptcha/recaptchalib_v2.php
Mike, Lead Developer of Image HESK: A surprisingly simple, user-friendly and FREE help desk software with integrated knowledgebase.
FormidableMulk
Posts: 13
Joined: Thu Oct 08, 2015 3:12 pm

Re: Error ReCaptcha V2

Post by FormidableMulk »

I'm running into the same thing with HESK v2.6.5 & Mods for HESK v2.42.

Was this issue resolved in 2.4 as planned? (I ought to check the change log; I haven't yet.) If not, could you repost the cURL-based solution of recaptchalib_v2.php? I tried to pull it down and from your raw.githubusercontent.com, but it looks like the file has been removed.
mkoch227
Posts: 666
Joined: Wed Jul 04, 2012 3:37 pm

Re: Error ReCaptcha V2

Post by mkoch227 »

The issue was resolved in Mods for HESK 2.4.0. Here's the link to the raw file: https://raw.githubusercontent.com/mkoch ... lib_v2.php
Mike, Lead Developer of Image HESK: A surprisingly simple, user-friendly and FREE help desk software with integrated knowledgebase.
FormidableMulk
Posts: 13
Joined: Thu Oct 08, 2015 3:12 pm

Re: Error ReCaptcha V2

Post by FormidableMulk »

Hmmm... I've got a clean install of HESK 2.6.5 paired with Mods for Hesk 2.42, but I'm still running into this error.

Code: Select all

<div align="left" class="alert alert-danger">
<b>Error:</b> Please correct the following errors:<br><br><ul><li>Incorrect SPAM Prevention answer, please try again.</li></ul></div>
The reCAPTCHA iframe displays in the Security Check block, let's me validate that I'm not a robot, and then at form submission, I'm taken back to the ticket submission page with the error above. PHP logs the following events:

Code: Select all

PHP Notice:  Use of undefined constant error - assumed 'error' in inc\recaptcha\recaptchalib_v2.php on line 154
PHP Notice:  Use of undefined constant codes - assumed 'codes' in inc\recaptcha\recaptchalib_v2.php on line 154
PHP Warning:  Missing argument 2 for hesk_removeAttachments(), called in submit_ticket.php on line 408 and defined in inc\attachments.inc.php on line 125
PHP Notice:  Undefined variable: isTicket in inc\attachments.inc.php on line 130
$remoteIp and $response are defined when I call the verifyResponse method. curl_init exist.
When I comment out the cURL fetch (lines 95-113 of inc/recaptcha/recaptchalib_v2.php) and rely on file_get_contents, it works.
mkoch227
Posts: 666
Joined: Wed Jul 04, 2012 3:37 pm

Re: Error ReCaptcha V2

Post by mkoch227 »

FormidableMulk wrote:

Code: Select all

PHP Notice:  Use of undefined constant error - assumed 'error' in inc\recaptcha\recaptchalib_v2.php on line 154
PHP Notice:  Use of undefined constant codes - assumed 'codes' in inc\recaptcha\recaptchalib_v2.php on line 154
What happens if you change $answers [error-codes] on line 154 to $answers['error-codes']? I doubt it will make a difference, but it's worth a shot since the "error-codes" should be surrounded in tick marks.
Mike, Lead Developer of Image HESK: A surprisingly simple, user-friendly and FREE help desk software with integrated knowledgebase.
FormidableMulk
Posts: 13
Joined: Thu Oct 08, 2015 3:12 pm

Re: Error ReCaptcha V2

Post by FormidableMulk »

What happens if you change $answers [error-codes] on line 154 to $answers['error-codes']?
2 events instead of 4; it resolves the two PHP notices about the $answers array, but the captcha still doesn't validate via cURL. :(


Remaining notices:

Code: Select all

[14-Oct-2015 15:31:03 US/Central] PHP Warning:  Missing argument 2 for hesk_removeAttachments(), called in submit_ticket.php on line 408 and defined in inc\attachments.inc.php on line 125
[14-Oct-2015 15:31:03 US/Central] PHP Notice:  Undefined variable: isTicket in inc\attachments.inc.php on line 130
Klemen
Site Admin
Posts: 10116
Joined: Fri Feb 11, 2005 4:04 pm

Re: Error ReCaptcha V2

Post by Klemen »

The notices are unrelated errors. Does reCaptcha show with this file (upload to "inc/recaptcha")?
http://hesk.com/extras/recaptchalib_v2.zip
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
FormidableMulk
Posts: 13
Joined: Thu Oct 08, 2015 3:12 pm

Re: Error ReCaptcha V2

Post by FormidableMulk »

Klemen wrote:Does reCaptcha show with ... http://hesk.com/extras/recaptchalib_v2.zip
I am able to submit a ticket using this reCAPTCHA library. I'll roll with your version instead using my cURL-bypassing tweak.

Thanks!
Klemen
Site Admin
Posts: 10116
Joined: Fri Feb 11, 2005 4:04 pm

Re: Error ReCaptcha V2

Post by Klemen »

Glad to hear it. This one will be included by default as of HESK 2.6.6
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
mkoch227
Posts: 666
Joined: Wed Jul 04, 2012 3:37 pm

Re: Error ReCaptcha V2

Post by mkoch227 »

So what exactly needed to be changed? All I noticed was that the SSL verification was disabled. Regardless I'll update the recaptchalib as well in the next Mods for HESK release (unless HESK 2.6.6 is released first ;) )
Mike, Lead Developer of Image HESK: A surprisingly simple, user-friendly and FREE help desk software with integrated knowledgebase.
Klemen
Site Admin
Posts: 10116
Joined: Fri Feb 11, 2005 4:04 pm

Re: Error ReCaptcha V2

Post by Klemen »

Yes, the trick is in disabling the peer verification.

It's not the best solution, but so many hosts out there have problems with it and trying to explain the issue to their support staff ("it's the script's fault") and getting it fixed by updating certificates on the server can be a nightmare.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Post Reply