View Full Version : Better CAPTCHA Support
geoffreyfishing
07-28-2010, 06:18 PM
Somebody might have already suggested this, but I just think it might be a good idea to add more CAPTCHA options. like, give users a choice of captcha's, and be able to upload more captcha's, maybe include recaptcha.
nsitc
08-03-2010, 01:09 PM
I agree. Here's a free CAPTCHA service that uses pictures instead of the warped and distorted words: http://demo.confidenttechnologies.com/captcha/
It would be great to have that as an option as well.
I have installed re-captcha just now because I was thinking of doing it and I saw your post.
I believe that I did this as elegantly as possible, but I am new to osticket, I installed it this evening for the first time.
Let me know if you have problems.
I have posted only the sections that need to be changed, if you can't figure out where the sections are well.... i certainly can't help.
1. sign up for recaptcha, make a note of your public key and private key and get the recaptchalib.php off the website.
2. Upload recaptchalib.php to your /include/ directory.
3. Change your open.php like this insert your own priv and public key
************************************************** ********************/
require('client.inc.php');
include_once(INCLUDE_DIR.'recaptchalib.php');
$publickey = "your public key from recaptcha";
$privatekey = "your private key from recaptcha";
define('SOURCE','Web'); //Ticket source.
$inc='open.inc.php'; //default include.
$errors=array();
if($_POST):
$_POST['deptId']=$_POST['emailId']=0; //Just Making sure we don't accept crap...only topicId is expected.
if(!$thisuser && $cfg->enableCaptcha()){
# was there a reCAPTCHA response?
if ($_POST["recaptcha_response_field"]) {
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if ($resp->is_valid) {
//put an extra action here.
} else {
# set the error code so that we can display it
$errors['captcha'] = "Incorrect captcha value, please re-type. ";
$errors['captcha'] .= $resp->error; //comment this out
}
}
else{
$errors['captcha'] = "You forgot to enter a captcha value, please re-enter.";
}
}
//Ticket::create...checks for errors..
4. Change open.inc.php to this
</tr>
<?}?>
<?if($cfg && $cfg->enableCaptcha() && (!$thisclient || !$thisclient->isValid())) {
if($_POST && $errors && !$errors['captcha'])
$errors['captcha']='Please re-enter the text again';
?>
<tr>
<th valign="top">Captcha:</th>
<td><?php echo recaptcha_get_html($publickey, $error); ?>
<font class="error"> <?=$errors['captcha']?></font>
</td>
</tr>
<?}?>
geoffreyfishing
09-14-2010, 10:46 PM
There are several mods, and its not hard to do, I just think it should be included by default.