set user creation to use the generic captcha api

This commit is contained in:
Shish 2010-01-05 17:57:10 +00:00
parent cbfab3ba5d
commit 62862994db
2 changed files with 3 additions and 14 deletions

View File

@ -5,8 +5,6 @@
* Description: Allows people to sign up to the website * Description: Allows people to sign up to the website
*/ */
require_once "lib/recaptchalib.php";
class UserBlockBuildingEvent extends Event { class UserBlockBuildingEvent extends Event {
var $parts = array(); var $parts = array();
@ -111,17 +109,9 @@ class UserPage extends SimpleExtension {
} }
else { else {
try { try {
if(strlen($config->get_string('api_recaptcha_privkey')) > 0) { if(!captcha_check()) {
$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"); throw new UserCreationException("Error in captcha");
} }
}
$uce = new UserCreationEvent($_POST['name'], $_POST['pass1'], $_POST['email']); $uce = new UserCreationEvent($_POST['name'], $_POST['pass1'], $_POST['email']);
send_event($uce); send_event($uce);

View File

@ -48,8 +48,7 @@ class UserPageTheme extends Themelet {
if(empty($tac)) {$html = "";} if(empty($tac)) {$html = "";}
else {$html = "<p>$tac</p>";} else {$html = "<p>$tac</p>";}
$rpk = $config->get_string("api_recaptcha_pubkey"); $reca = captcha_get_html();
$reca = empty($rpk) ? "" : "<tr><td colspan='2'>".recaptcha_get_html($rpk)."</td></tr>";
$html .= " $html .= "
<form action='".make_link("user_admin/create")."' method='POST'> <form action='".make_link("user_admin/create")."' method='POST'>