Well I installed my own solution using
http://captchas.net/ free captcha service.
I put some code in the Gforum/User.pm and added some html to user_signup.html
Here is how I did it, but I do not have time to make a plugin, sorry
If you attempt this, make a backup of your User.pm before you begin. Try it at your own risk.
Make a folder in gforum/admin/GForum called WebService
get CaptchasDotNet.pm from captchas.net perl page
edit the first line to read:
package GForum::WebService::CaptchasDotNet;
now, upload the file to gforum/admin/GForum/WebService
You must register at captchas.net for a free account, they email you the
"client" and "secret" user / password
You must change the "client" and "secret" string values in the code below to add your account user/ password
client => 'demo',
secret => 'secret',
Edit Gforum/User.pm
near the top in sub signup
Find:
Code:
require GForum::Payment;
my $payment = GForum::Payment::get_signup_config();
my $payment_methods = GForum::Payment::methods();
return(
$page => {
email_validation_required => !$CFG->{require_signup_email_validation},
admin_validation_required => !$CFG->{require_signup_admin_validation},
%user_data,
@errors ? (errors => \@errors) : (),
%$payment,
%$payment_methods
}
);
Replace:
Code:
require GForum::Payment;
my $payment = GForum::Payment::get_signup_config();
my $payment_methods = GForum::Payment::methods();
# mjc bof added for captcha
use GForum::WebService::CaptchasDotNet;
my $captchas = GForum::WebService::CaptchasDotNet->new(
client => 'demo',
secret => 'secret',
alphabet => 'abcdefghkmnopqrstuvwxyz',
letters => 6,
width => 240,
height => 80,
);
my %captcha;
$captcha{captcha_random} = $captchas->random;
$captcha{captcha_image_url} = $captchas->image_url;
$captcha{captcha_audio_url} = $captchas->audio_url;
$captcha{captcha_image} = $captchas->image;
# mjc eof also added %captcha to return array below
return(
$page => {
email_validation_required => !$CFG->{require_signup_email_validation},
admin_validation_required => !$CFG->{require_signup_admin_validation},
%user_data,
@errors ? (errors => \@errors) : (),
%$payment,
%$payment_methods,
%captcha
}
);
near the middle in sub signup_submit
Find:
Code:
sub signup_submit {
shift;
my ($do, $func) = @_;
my $page = $func->{page};
my $input = $IN->get_hash;
Replace:
Code:
sub signup_submit {
shift;
my ($do, $func) = @_;
my $page = $func->{page};
my $input = $IN->get_hash;
# mjc bof added captcha
use GForum::WebService::CaptchasDotNet;
my $captchas = GForum::WebService::CaptchasDotNet->new(
client => 'demo',
secret => 'secret',
alphabet => 'abcdefghkmnopqrstuvwxyz',
letters => 6
);
my $password = $input->{captcha_password};
my $random = $input->{captcha_random};
# Return an error message, when reading the form values fails.
if (not (defined ($password) and
defined ($random))) {
return GForum::do_func(user_signup => 'Invalid arguments for captcha text image test.');
}
# Check the random string to be valid and return an error message
# otherwise.
if (not $captchas->validate ($random)) {
return GForum::do_func(user_signup => 'Every CAPTCHA can only be used once. The current CAPTCHA has already been used. Try again.');
}
# Check that the right CAPTCHA password has been entered and
# return an error message otherwise.
# Attention: Only call verify if validate is true
if (not $captchas->verify ($password)) {
return GForum::do_func(user_signup => 'You entered the wrong pass phrase for the text image. Aren\'t you human? Please use back button and reload.');
}
# mjc eof captcha
edit user_signup.html
Find:
Code:
<td colspan=2 align=right style="border-top:1px solid <%dark_beige%>">
<input class="submit" type=submit value="Signup!">
Replace:
Code:
<td colspan=2 align=right style="border-top:1px solid <%dark_beige%>">
<input type="hidden" name="captcha_random" value="<%captcha_random%>">
<p>Please enter the phrase made of letters in the image below:
<input type="text" name="captcha_password" size="6"><br>
<%unescape_html captcha_image%><br>
<a href="<%captcha_audio_url%>">Phonetic spelling (mp3)</a>
<p>
<input class="submit" type=submit value="Click Here To Register!">
If you use this please reply here, I like to know if i was any help or not.
----------
Michael J. Challis - CRUZN8R - PT Cruiser Club -
http://www.ptcruiserclub.org http://www.ptcruiserclub.org/forum