MDL-51217 auth: Check if recaptcha enabled in the plugin used for signup.
authorRuslan Kabalin <r.kabalin@lancaster.ac.uk>
Wed, 26 Aug 2015 13:34:43 +0000 (14:34 +0100)
committerRuslan Kabalin <r.kabalin@lancaster.ac.uk>
Wed, 26 Aug 2015 14:25:40 +0000 (15:25 +0100)
auth/email/auth.php
login/signup_form.php

index 3f037d7..970a16f 100644 (file)
@@ -240,7 +240,7 @@ class auth_plugin_email extends auth_plugin_base {
      */
     function is_captcha_enabled() {
         global $CFG;
-        return isset($CFG->recaptchapublickey) && isset($CFG->recaptchaprivatekey) && get_config("auth/{$this->authtype}", 'recaptcha');
+        return $this->config->recaptcha;
     }
 
 }
index 83ce9fc..0e11761 100644 (file)
@@ -192,7 +192,8 @@ class login_signup_form extends moodleform {
      */
     function signup_captcha_enabled() {
         global $CFG;
-        return !empty($CFG->recaptchapublickey) && !empty($CFG->recaptchaprivatekey) && get_config('auth/email', 'recaptcha');
+        $authplugin = get_auth_plugin($CFG->registerauth);
+        return !empty($CFG->recaptchapublickey) && !empty($CFG->recaptchaprivatekey) && $authplugin->is_captcha_enabled();
     }
 
 }