From 9f37a5025628e479cc9b23e190973c9d49b93648 Mon Sep 17 00:00:00 2001 From: Shish Date: Tue, 10 Nov 2009 03:21:02 +0000 Subject: [PATCH] signup captcha --- ext/user/main.php | 13 +++++++++++++ ext/user/theme.php | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/ext/user/main.php b/ext/user/main.php index 4816db7e..1db4fe7d 100644 --- a/ext/user/main.php +++ b/ext/user/main.php @@ -1,4 +1,5 @@ get_string('api_recaptcha_privkey')) > 0) { + $resp = recaptcha_check_answer( + $config->get_string('api_recaptcha_privkey'), + $_SERVER["REMOTE_ADDR"], + $_POST["recaptcha_challenge_field"], + $_POST["recaptcha_response_field"]); + + if(!$resp->is_valid) { + throw new UserCreationException("Error in captcha"); + } + } + $uce = new UserCreationEvent($_POST['name'], $_POST['pass1'], $_POST['email']); send_event($uce); $this->set_login_cookie($uce->username, $uce->password); diff --git a/ext/user/theme.php b/ext/user/theme.php index f51147a9..b36d529c 100644 --- a/ext/user/theme.php +++ b/ext/user/theme.php @@ -48,6 +48,9 @@ class UserPageTheme extends Themelet { if(empty($tac)) {$html = "";} else {$html = "

$tac

";} + $rpk = $config->get_string("api_recaptcha_pubkey"); + $reca = empty($rpk) ? "" : "".recaptcha_get_html($rpk).""; + $html .= "
@@ -55,6 +58,7 @@ class UserPageTheme extends Themelet { + $reca
Password
Repeat Password
Email (Optional)