From 7f2033eafef49df12859b58e5bf220cfd32e761c Mon Sep 17 00:00:00 2001 From: Ruslan Kabalin <r.kabalin@lancaster.ac.uk> Date: Wed, 26 Aug 2015 14:34:43 +0100 Subject: [PATCH] MDL-51217 auth: Check if recaptcha enabled in the plugin used for signup. --- auth/email/auth.php | 2 +- login/signup_form.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/auth/email/auth.php b/auth/email/auth.php index 3f037d73129..970a16f9458 100644 --- a/auth/email/auth.php +++ b/auth/email/auth.php @@ -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; } } diff --git a/login/signup_form.php b/login/signup_form.php index 83ce9fcedee..0e1176175e6 100644 --- a/login/signup_form.php +++ b/login/signup_form.php @@ -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(); } }