diff options
Diffstat (limited to 'pinyweb')
-rwxr-xr-x | pinyweb/cgi-bin/newuser.cgi | 26 | ||||
-rw-r--r-- | pinyweb/debian/control | 2 |
2 files changed, 12 insertions, 16 deletions
diff --git a/pinyweb/cgi-bin/newuser.cgi b/pinyweb/cgi-bin/newuser.cgi index 9675a5e..159db63 100755 --- a/pinyweb/cgi-bin/newuser.cgi +++ b/pinyweb/cgi-bin/newuser.cgi @@ -9,8 +9,7 @@ use CGI; use Crypt::CBC; use IPC::Open2; -use MIME::Base32 qw( RFC ); -use Captcha::reCAPTCHA; +use MIME::Base32; use Piny::Auth; @@ -53,23 +52,20 @@ if( scalar( $q->param("n") ) && scalar( $q->param("a") ) && scalar( $q->param("p print( "I'm sorry, the link you followed is invalid.\n" ); }; } else { # No hash, they need one sent to their address - # CAPTCHA check - if ( -f "/etc/recaptcha/private.key" ) { - if ( scalar( $q->param('recaptcha_response_field') ) && scalar( $q->param('recaptcha_challenge_field') ) ) { - open(RECAPTCHA, '/etc/recaptcha/private.key') || ( print "Can't read recaptcha key: [$!]\n" && exit 0 ); - my $recaptchakey = <RECAPTCHA>; - close (RECAPTCHA); - chomp($recaptchakey); - my $c = Captcha::reCAPTCHA->new; - my $result = $c->check_answer( $recaptchakey, $ENV{'REMOTE_ADDR'}, scalar( $q->param( 'recaptcha_challenge_field' ) ), scalar( $q->param( 'recaptcha_response_field' ) ) ); - if ( $result->{is_valid} ) { - print "Good recaptcha submission.\n" + if ( -f "/etc/piny/captcha" ) { + if ( scalar( $q->param('c') ) ) { + open(CAPTCHA, '/etc/piny/captcha') || ( print "Can't read captcha file: [$!]\n" && exit 0 ); + my $captcha = <CAPTCHA>; + close (CAPTCHA); + chomp( $captcha ); + if ( $captcha eq scalar( $q->param('c') ) ) { + print "Good captcha submission.\n" } else { - print "Bad recaptcha submission: $result->{error}\n"; + print "Bad captcha submission.\n"; exit 0; }; } else { - print( "Missing recaptcha parameters." ); + print( "Missing or incorrect \"c\" captcha parameter." ); exit 0; }; }; diff --git a/pinyweb/debian/control b/pinyweb/debian/control index fd44de3..618b3b2 100644 --- a/pinyweb/debian/control +++ b/pinyweb/debian/control @@ -8,7 +8,7 @@ Standards-version: 3.9.1 Package: pinyweb Architecture: any -Depends: ${perl:Depends}, ${misc:Depends}, ${shlibs:Depends}, libcrypt-blowfish-perl, libcrypt-cbc-perl, libjson-perl, libmime-base32-perl, libcaptcha-recaptcha-perl, libpiny-perl (>= 0.14), pinyadmin (>= 0.10) +Depends: ${perl:Depends}, ${misc:Depends}, ${shlibs:Depends}, libcrypt-blowfish-perl, libcrypt-cbc-perl, libjson-perl, libmime-base32-perl, libpiny-perl (>= 0.14), pinyadmin (>= 0.10) Description: CGIs for managing piny repositories The CGI programs for day-to-day administrative tasks in the Piny infrastructure. |