summaryrefslogtreecommitdiff
path: root/pinyweb/cgi-bin
diff options
context:
space:
mode:
authorJoe Rayhawk <jrayhawk@omgwallhack.org>2018-11-27 01:09:09 -0800
committerJoe Rayhawk <jrayhawk@omgwallhack.org>2018-11-27 01:09:09 -0800
commitff6c62dcb4b5f323172788d1d90c3c3492651da9 (patch)
treeeabfe3115eb8a69d4654209ee25cfec46cb7433b /pinyweb/cgi-bin
parent4f593e7108258b8a4abb033cbc6b2eca2fc7845a (diff)
downloadpiny-code-ff6c62dcb4b5f323172788d1d90c3c3492651da9.tar.gz
piny-code-ff6c62dcb4b5f323172788d1d90c3c3492651da9.zip
pinyweb: newuser: remove google's broken captcha api
Diffstat (limited to 'pinyweb/cgi-bin')
-rwxr-xr-xpinyweb/cgi-bin/newuser.cgi26
1 files changed, 11 insertions, 15 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;
};
};