From: nicolasconnault Date: Wed, 23 Jul 2008 05:23:43 +0000 (+0000) Subject: MDL-15682 Fixed, merged from MOODLE_19_STABLE X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=f85509b59c71e17ca8fb8984ee9ba01dd3dacf50;p=moodle.git MDL-15682 Fixed, merged from MOODLE_19_STABLE --- diff --git a/lang/en_utf8/moodle.php b/lang/en_utf8/moodle.php index 88d13c7cc3..fa11b80c92 100644 --- a/lang/en_utf8/moodle.php +++ b/lang/en_utf8/moodle.php @@ -508,7 +508,7 @@ If you need help, please contact the site administrator, $a->admin'; $string['emailpasswordconfirmationsubject'] = '$a: Change password confirmation'; $string['emailpasswordconfirmmaybesent'] = '

If you supplied a correct username or email address then an email should have been sent to you.

-

It contains easy instructions to confirm and complete this password change. +

It contains easy instructions to confirm and complete this password change. If you continue to have difficulty, please contact the site administrator.

'; $string['emailpasswordconfirmsent'] = 'An email should have been sent to your address at $a.
It contains easy instructions to confirm and complete this password change. @@ -946,6 +946,7 @@ $string['missinglastname'] = 'Missing surname'; $string['missingname'] = 'Missing name'; $string['missingnewpassword'] = 'Missing new password'; $string['missingpassword'] = 'Missing password'; +$string['missingrecaptchachallengefield'] = 'Missing reCAPTCHA challenge field'; $string['missingreqreason'] = 'Missing reason'; $string['missingshortname'] = 'Missing short name'; $string['missingshortsitename'] = 'Missing short site name'; diff --git a/login/signup_form.php b/login/signup_form.php index 54c881ece4..200fcdb920 100644 --- a/login/signup_form.php +++ b/login/signup_form.php @@ -62,7 +62,7 @@ class login_signup_form extends moodleform { }else{ $mform->setDefault('country', ''); } - + if (signup_captcha_enabled()) { $mform->addElement('recaptcha', 'recaptcha_element', get_string('recaptcha', 'auth'), array('https' => $CFG->loginhttps)); $mform->setHelpButton('recaptcha_element', array('recaptcha', get_string('recaptcha', 'auth'))); @@ -136,17 +136,23 @@ class login_signup_form extends moodleform { if (!check_password_policy($data['password'], $errmsg)) { $errors['password'] = $errmsg; } - + if (signup_captcha_enabled()) { - $recaptcha_element = $this->_form->getElement('recaptcha_element'); - $challenge_field = $this->_form->_submitValues['recaptcha_challenge_field']; - $response_field = $this->_form->_submitValues['recaptcha_response_field']; - if (true !== ($result = $recaptcha_element->verify($challenge_field, $response_field))) { - $errors['recaptcha'] = $result; + $recaptcha_element = $this->_form->getElement('recaptcha_element'); + if (!empty($this->_form->_submitValues['recaptcha_challenge_field'])) { + $challenge_field = $this->_form->_submitValues['recaptcha_challenge_field']; + $response_field = $this->_form->_submitValues['recaptcha_response_field']; + if (true !== ($result = $recaptcha_element->verify($challenge_field, $response_field))) { + $errors['recaptcha'] = $result; + } + } else { + $errors['recaptcha'] = get_string('missingrecaptchachallengefield'); } } - return $errors; + return $errors; + + } }