MDL-43632 mod_feedback: Use SSL for reCAPTCHA API request if Moodle is using it

This commit is contained in:
Tony Butler
2014-01-20 17:13:57 +08:00
committed by Damyon Wiese
parent 785e7d36a7
commit 2e7b157bb8
+9 -1
View File
@@ -231,9 +231,17 @@ class feedback_item_captcha extends feedback_item_base {
<a href="javascript:Recaptcha.switch_type(\'image\')">' . $strgetanimagecaptcha . '</a>
</div>
</div>';
// Check if we are using SSL.
if (strpos($CFG->wwwroot, 'https://') === 0) {
$ssl = true;
} else {
$ssl = false;
}
//we have to rename the challengefield
if (!empty($CFG->recaptchaprivatekey) AND !empty($CFG->recaptchapublickey)) {
$captchahtml = recaptcha_get_html($CFG->recaptchapublickey, null);
$captchahtml = recaptcha_get_html($CFG->recaptchapublickey, null, $ssl);
echo $html.$captchahtml;
}
}