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) ? "" : "