diff options
Diffstat (limited to 'src/controllers')
-rw-r--r-- | src/controllers/Users.class.php | 13 |
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); |