lib/hosted
Jeroen van Meeuwen
vanmeeuwen at kolabsys.com
Thu Aug 16 16:32:48 CEST 2012
lib/hosted/kolab_client_task_signup.php | 27 ++++++++++++++++-----------
1 file changed, 16 insertions(+), 11 deletions(-)
New commits:
commit 375b8d33f00ea38a966b08c5e78b2e322cc5006b
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date: Thu Aug 16 16:32:19 2012 +0200
If no recaptcha private key has been configured, we ought to not verify the captcha either
diff --git a/lib/hosted/kolab_client_task_signup.php b/lib/hosted/kolab_client_task_signup.php
index 50b784b..359e6fa 100644
--- a/lib/hosted/kolab_client_task_signup.php
+++ b/lib/hosted/kolab_client_task_signup.php
@@ -122,18 +122,23 @@ class kolab_client_task_signup extends kolab_client_task
public function action_add_user() {
$data = $this->get_input('data', 'POST');
- // Check for valid CAPTCHA
- $resp = recaptcha_check_answer(
- $this->config_get('recaptcha_private_key'),
- $_SERVER['REMOTE_ADDR'],
- $data['recaptcha_challenge_field'],
- $data['recaptcha_response_field']
- );
+ $private_key = $this->config_get('recaptcha_private_key');
+
+ if (!empty($private_key)) {
+ // Check for valid CAPTCHA
+ $resp = recaptcha_check_answer(
+ $private_key,
+ $_SERVER['REMOTE_ADDR'],
+ $data['recaptcha_challenge_field'],
+ $data['recaptcha_response_field']
+ );
+
+ if (!$resp->is_valid) {
+ // What happens when the CAPTCHA was entered incorrectly
+ $this->output->command('display_message', "The reCAPTCHA wasn't entered correctly. Please reload and try it again.", 'error');
+ return;
+ }
- if (!$resp->is_valid) {
- // What happens when the CAPTCHA was entered incorrectly
- $this->output->command('display_message', "The reCAPTCHA wasn't entered correctly. Please reload and try it again.", 'error');
- return;
}
// Check again for user availability before adding user
More information about the commits
mailing list