summaryrefslogtreecommitdiff
path: root/src/controllers/Users.class.php
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2011-09-22 18:20:47 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2011-09-22 18:20:47 -0400
commitfef0de218e9485ea3db394f3e173b3c64a0463a8 (patch)
tree935f5a3e32e03d0f964608afb6d0cb67f335063f /src/controllers/Users.class.php
parent485cc0fad823d50ed07df15f629ff824d2332ece (diff)
Add an ugly hacky-hacked reCaptcha to new user registration.
Diffstat (limited to 'src/controllers/Users.class.php')
-rw-r--r--src/controllers/Users.class.php13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/controllers/Users.class.php b/src/controllers/Users.class.php
index d799760..ed6f739 100644
--- a/src/controllers/Users.class.php
+++ b/src/controllers/Users.class.php
@@ -128,8 +128,12 @@ class Users extends Controller {
@$vars['username' ] = $_POST['auth_name'];
@$vars['password1'] = $_POST['auth_password' ];
@$vars['password2'] = $_POST['auth_password_verify'];
+ @$recaptcha_response = $_POST['recaptcha_response_field'];
+ @$recaptcha_challenge = $_POST['recaptcha_challenge_field'];
global $mm; $db = $mm->database();
+ $publickey = $db->getPluginConf('ReCaptcha', 'public_key');
+ $privatekey = $db->getPluginConf('ReCaptcha', 'private_key');
$vars['errors'] = array();
if ($db->getUID($vars['username'])!==false)
@@ -143,6 +147,15 @@ class Users extends Controller {
if ($matches && $vars['password2'] == '') {
$vars['errors'][] = 'no pw';
}
+ require_once('recaptchalib.php');
+ $resp = recaptcha_check_answer($privatekey,
+ $_SERVER['REMOTE_ADDR'],
+ $recaptcha_challenge,
+ $recaptcha_response);
+ if (!$resp->is_valid) {
+ $vars['errors'][] = 'recaptcha';
+ $vars['recaptcha_error'] = $resp->error;
+ }
if (count($vars['errors']) > 0) {
$this->new_user($routed, $vars);