Permalink
Browse files

MDL-43632 mod_feedback: Use SSL for reCAPTCHA API request if Moodle i…

…s using it
  • Loading branch information...
1 parent 785e7d3 commit 2e7b157bb8aed3dea9ec6024804180c1aba33173 @tonyjbutler tonyjbutler committed with damyon Jan 9, 2014
Showing with 9 additions and 1 deletion.
  1. +9 −1 mod/feedback/item/captcha/lib.php
@@ -231,9 +231,17 @@ public function print_item_complete($item, $value = '', $highlightrequire = fals
<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;
}
}

0 comments on commit 2e7b157

Please sign in to comment.