]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-15682 Fixed, merged from MOODLE_19_STABLE
authornicolasconnault <nicolasconnault>
Wed, 23 Jul 2008 05:23:43 +0000 (05:23 +0000)
committernicolasconnault <nicolasconnault>
Wed, 23 Jul 2008 05:23:43 +0000 (05:23 +0000)
lang/en_utf8/moodle.php
login/signup_form.php

index 88d13c7cc38cc86e29a279aa15b06d585c71c0d4..fa11b80c9273654f36687f26f54494677c0664ba 100644 (file)
@@ -508,7 +508,7 @@ If you need help, please contact the site administrator,
 $a->admin';
 $string['emailpasswordconfirmationsubject'] = '$a: Change password confirmation';
 $string['emailpasswordconfirmmaybesent'] = '<p>If you supplied a correct username or email address then an email should have been sent to you.</p>
-   <p>It contains easy instructions to confirm and complete this password change.\r
+   <p>It contains easy instructions to confirm and complete this password change.
 If you continue to have difficulty, please contact the site administrator.</p>';
 $string['emailpasswordconfirmsent'] = 'An email should have been sent to your address at <b>$a</b>.
 <br />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';
index 54c881ece408d76b5cdc64da0bf3216f079df95c..200fcdb920d93decb6b3ecfa614cb91ff9bbc039 100644 (file)
@@ -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;
+
+
     }
 }