ElkArte Community

Extending Elk => Addons => Topic started by: Ant59 on February 23, 2015, 07:18:03 am

Title: [ADDON] ReCAPTCHA
Post by: Ant59 on February 23, 2015, 07:18:03 am
I've written an reCaptcha addon for Elkarte using the v2 Google reCaptcha service which uses a checkbox instead of verification text for most uses it deems to be likely human.

Grab the addon: https://github.com/Xydre/elkarte-recaptcha

(http://i.imgur.com/ssqe08U.png)
Title: Re: [ADDON] ReCAPTCHA
Post by: emanuele on February 23, 2015, 08:15:09 am
Nice to see new ways to fight spam! :D
Title: Re: [ADDON] ReCAPTCHA
Post by: Burke Knight on June 09, 2015, 07:47:10 pm
Got a few errors for each person that tries to register:

QuoteGuest
Today at 07:22:42 PM
Type of error: General
8: Trying to get property of non-object
URL /index.php?action=register2
File: /sources/subs/reCaptcha.class.php
Line: 65
      
Guest
Today at 07:22:42 PM
Type of error: Undefined
8: Undefined variable: resp
URL /index.php?action=register2
File: /sources/subs/reCaptcha.class.php
Line: 65
      
Guest
Today at 07:22:42 PM
Type of error: Undefined
8: Undefined index: g-recaptcha-response
URL /index.php?action=register2
File: /sources/subs/reCaptcha.class.php
Line: 58

Here is my reCaptcha.class.php file, too.
Title: Re: [ADDON] ReCAPTCHA
Post by: emanuele on June 10, 2015, 11:38:54 am
I would change the block:
Code: [Select]
	
public function doTest()
{
$this->_recaptcha = new ReCaptcha($this->_secret_key);

if ($_POST["g-recaptcha-response"]) {
$resp = $this->_recaptcha->verifyResponse (
$_SERVER["REMOTE_ADDR"],
$_POST["g-recaptcha-response"]
);
}

if (!$resp->success)
return 'wrong_verification_code';

return true;
}

to:
Code: [Select]
	public function doTest()
{
$this->_recaptcha = new ReCaptcha($this->_secret_key);

if ($_POST["g-recaptcha-response"]) {
$resp = $this->_recaptcha->verifyResponse (
$_SERVER["REMOTE_ADDR"],
$_POST["g-recaptcha-response"]
);
if (!$resp->success)
return 'wrong_verification_code';
}
else
return 'wrong_verification_code';

return true;
}
Title: Re: [ADDON] ReCAPTCHA
Post by: Burke Knight on June 10, 2015, 01:07:28 pm
Still getting 2 errors for line 58:

Code: [Select]
if ($_POST["g-recaptcha-response"]) {

1 error per person, so we almost there.  ;D
Title: Re: [ADDON] ReCAPTCHA
Post by: emanuele on June 10, 2015, 02:52:32 pm
I guess:
Code: [Select]
if (!empty($_POST["g-recaptcha-response"])) {
:D
Title: Re: [ADDON] ReCAPTCHA
Post by: Burke Knight on June 10, 2015, 03:35:53 pm
That did the trick, it seems. At least, for test account I just did. :)
Title: Re: [ADDON] ReCAPTCHA
Post by: Spuds on February 27, 2017, 07:19:49 pm
A bump!

I made a few updates to this package and put it on the addon site http://addons.elkarte.net/security/reCaptcha.html

This update allows you to specify the language code (from google) and uses ElkArtes functions for posting the form data back to Google, and loads as a deferred/async script.
Title: Re: [ADDON] ReCAPTCHA
Post by: billwill on March 24, 2017, 10:00:27 am
Hi Spuds -
Just installed the package. On the page you referenced, there is a screenshot showing where to enable/disable this package and to add the key pair .  However, I don't see a way to get to this screen from the install.  How do you get to that screen?
Title: Re: [ADDON] ReCAPTCHA
Post by: Spuds on March 24, 2017, 10:09:50 am
It should be under 
Admin -> Security and Moderation -> Anti Spam 
on that screen, at the bottom is where it should show up ... if not then I made a mistake when I put the package together !
Title: Re: [ADDON] ReCAPTCHA
Post by: kucing on March 24, 2017, 10:10:54 am
@billwill

it's in Configuration > Security and Moderation > Anti Spam.
Title: Re: [ADDON] ReCAPTCHA
Post by: billwill on March 24, 2017, 10:13:38 am
And there it is.  Thanks kucing!
Title: Re: [ADDON] ReCAPTCHA
Post by: Fenderen on March 29, 2017, 07:12:53 am
Great! A new way to prevent spam. Please keep improving on this.
Title: Re: [ADDON] ReCAPTCHA
Post by: Spuds on November 26, 2017, 05:43:53 pm
Updated package for ElkArte 1.1 ( http://addons.elkarte.net/security/reCaptcha.html )
Title: Re: [ADDON] ReCAPTCHA
Post by: Perand on January 18, 2018, 09:20:45 am
Thanks Spuds I needed that  8)
Title: Re: [ADDON] ReCAPTCHA
Post by: kucing on March 09, 2021, 05:28:36 am
Hi, bumping this.

Maybe there is a bug. If this addon activated, then question and answer will be gone.