Permalink
Browse files

MDL-27364 use https for recaptcha when site runs via https

Based on solution by Rajesh Taneja.
  • Loading branch information...
skodak authored and nebgor committed Dec 6, 2011
1 parent 808a762 commit b4261ffdf7d0d5807b707d6dd9d16bab7e344b6a
Showing with 5 additions and 2 deletions.
  1. +5 −2 lib/form/recaptcha.php
View
@@ -34,10 +34,13 @@ class MoodleQuickForm_recaptcha extends HTML_QuickForm_input {
* </code>
*/
function MoodleQuickForm_recaptcha($elementName = null, $elementLabel = null, $attributes = null) {
+ global $CFG;
parent::HTML_QuickForm_input($elementName, $elementLabel, $attributes);
$this->_type = 'recaptcha';
- if (!empty($attributes['https'])) {
- $this->_https = $attributes['https'];
+ if (!empty($attributes['https']) or strpos($CFG->httpswwwroot, 'https:') === 0) {
+ $this->_https = true;
+ } else {
+ $this->_https = false;
}
}

0 comments on commit b4261ff

Please sign in to comment.