OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Using ReCAPTCHA

Are you responsible for making OJS work -- installing, upgrading, migrating or troubleshooting? Do you think you've found a bug? Post in this forum.

Moderators: jmacgreg, btbell, michael, bdgregg, barbarah, asmecher

Forum rules
What to do if you have a technical problem with OJS:

1. Search the forum. You can do this from the Advanced Search Page or from our Google Custom Search, which will search the entire PKP site. If you are encountering an error, we especially recommend searching the forum for said error.

2. Check the FAQ to see if your question or error has already been resolved.

3. Post a question, but please, only after trying the above two solutions. If it's a workflow or usability question you should probably post to the OJS Editorial Support and Discussion subforum; if you have a development question, try the OJS Development subforum.

Using ReCAPTCHA

Postby kmlawson » Thu Feb 12, 2009 5:54 am

I understand you have an optional CAPTCHA feature that can be turned on in the config file. I'm rather fond of the ReCAPTCHA solution and was wondering if it would be possible to implement this without too much difficulty.

http://recaptcha.net/

I'm familiar with PHP and am willing to make some code changes to make this work but would love a few tips to get me going quickly. In general terms, where and what files would I need to hack to get ReCAPTCHA working on comments in OJS?

If I get this up and running I'd be happy to share with the forum how I went about it but would love a head start with tips here.

Best,

Konrad (chinajapan.org/articles)
kmlawson
 
Posts: 2
Joined: Thu Feb 12, 2009 5:47 am

Re: Using ReCAPTCHA

Postby mcrider » Thu Feb 12, 2009 11:43 am

Hi Konrad,

I like reCaptcha too, especially given the initiatives of the Public Knowledge Project (reCaptcha helps digitize books). This would definitely involve some legwork, but it shouldn't be too difficult if you're familiar with PHP, as displaying a recaptcha and authorizing it is essentially the same process as we use for the regular captcha.

You could create a new class called reCaptcha, and model it off of the the Captcha class in classes/captcha/Captcha.inc.php, include the PHP library provided by reCaptcha here, and then modify the CaptchaManager class to be able to use the reCaptcha class (ideally, it would check the config.inc.php file for a setting saying what type of Captcha to use, just as the call Config::getVar('captcha', 'captcha') checks to see if Captcha is enabled). Then, in the rest of the code where the CaptchaManager is called (and a captcha is displayed), you shouldn't have to make any modifications. Don't worry about the CaptchaDAO (which handles database calls), as reCaptcha does most of the work on their server, you won't have to worry about any database manipulation on the OJS end.

Hope that's enough to get you started,
Matt
mcrider
 
Posts: 952
Joined: Mon May 05, 2008 10:29 am
Location: Vancouver, BC

Re: Using ReCAPTCHA

Postby kmlawson » Sat Feb 14, 2009 2:06 am

Thanks for taking the time to give me these tips. I'm less familiar with the OOP side of PHP but this could be a fun project. I can't make any promises but for now I'll drop this into my "Coding ideas" folder and if I get it working will post something here. Perhaps by that time, some future version of OJS already supports ReCAPTCHA but we'll see.

Thanks again!

Wonderful work on OJS. It has something of a learning curve and is a bit too rich for a 2 person operation but now that I think I understand how things work we are up and running with our new OA gold journal at chinajapan.org.

Some suggestions while I'm here:

-put links to each of the supplemental materials (like a map etc.) below the abstract of a paper like the like to add a comment (rather than via a link to supplemental files in the frame of the reader tools). The way it is now makes it very easy to miss available resources.

-create some way for OJS to recognize a separate permanent linking structure. the current system has rather long links due to the file structure of OJS. In our case it is something like (http://chinajapan.org/articles/index.ph ... cle/view/1) for an article and even if I had installed OJS in the home directory the link would still be pretty long. I have set up an htaccess file which supports our own short url form for permanent linking to a pdf of the document. in the above case (http://chinajapan.org/articles/16/1)
kmlawson
 
Posts: 2
Joined: Thu Feb 12, 2009 5:47 am

Re: Using ReCAPTCHA

Postby omegadraconis » Thu Feb 26, 2009 11:27 am

I am also interested in doing the same thing. Thanks for the tips, if I do get anywhere with it I will post code here.
omegadraconis
 
Posts: 1
Joined: Thu Feb 26, 2009 11:24 am

Re: Using ReCAPTCHA

Postby solty » Tue Mar 23, 2010 4:48 am

I was create API key
I was add below to the config.inc.php
----------------
Whether or not to enable Captcha features
captcha = on

Whether or not to use Captcha on user registration / account creation
captcha_on_register = on
--------------
I was created this code from CAPTCHA after the registration:

require_once('recaptchalib.php');
$publickey = "6Lf0AQwAAAAAAB9oBp5xrRxsasxnxJPtyD7XsasPW4WDNZ"; // you got this from the signup page
echo recaptcha_get_html($publickey);

require_once('recaptchalib.php');
$privatekey = "6Lf0AQwAAAAAAF-LZsasaO9S7S_2sasykaGPjt8ijSrloCs";
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);

if (!$resp->is_valid) {
die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
"(reCAPTCHA said: " . $resp->error . ")");
}
-------------
and also, where is the location Captcha.inc.php.

I am new php code system.

Could you suggest contain sample code mentioned files (config.inc.php, recaptchalib.php, and also Captcha.inc.php.) and files location?
solty
 
Posts: 140
Joined: Mon Mar 16, 2009 12:47 am
Location: Turkiye, İzmir

Re: Using ReCAPTCHA

Postby jmacgreg » Tue Mar 30, 2010 9:13 pm

Hi Solty,

I think this is a pretty old thread; but hopefully folks in it are still working on a reCaptcha module. We've added this as a feature request to Bugzilla here, but haven't quite gotten around to it yet, so you won't yet be able to use those reCaptcha keys with OJS. I'd suggest CCing yourself to that report for future updates, though!

Cheers,
Jaems
jmacgreg
 
Posts: 4190
Joined: Tue Feb 14, 2006 10:50 am

Re: Using ReCAPTCHA

Postby mduckham » Wed Jul 28, 2010 5:13 pm

Does anyone have an update on the status of ReCAPTCHA module? Has anyone had success with one of these workarounds in this thread? I would also urgently like ReCAPTCHA support to enable low-vision accessibility at my OJS site, so would like to hear any experiences on the best way to do this (given limited php abilities).
mduckham
 
Posts: 1
Joined: Tue Jul 27, 2010 10:51 pm


Return to OJS Technical Support

Who is online

Users browsing this forum: Bing [Bot], swing and 4 guests