Skip to content

Commit

Permalink
MDL-51390 badges: Switch backpack URL to use HTTPS
Browse files Browse the repository at this point in the history
Signed-off-by: Yuliya Bozhko <[email protected]>
  • Loading branch information
Yuliya Bozhko committed Sep 28, 2015
1 parent fd57d68 commit 4d0ebde
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
6 changes: 3 additions & 3 deletions badges/backpack_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function definition() {
$mform->addElement('html', html_writer::tag('span', '', array('class' => 'notconnected', 'id' => 'connection-error')));
$mform->addElement('header', 'backpackheader', get_string('backpackconnection', 'badges'));
$mform->addHelpButton('backpackheader', 'backpackconnection', 'badges');
$mform->addElement('static', 'url', get_string('url'), 'http://' . BADGE_BACKPACKURL);
$mform->addElement('static', 'url', get_string('url'), BADGE_BACKPACKURL);
$status = html_writer::tag('span', get_string('notconnected', 'badges'),
array('class' => 'notconnected', 'id' => 'connection-status'));
$mform->addElement('static', 'status', get_string('status'), $status);
Expand All @@ -67,7 +67,7 @@ public function definition() {
$mform->addElement('hidden', 'userid', $USER->id);
$mform->setType('userid', PARAM_INT);

$mform->addElement('hidden', 'backpackurl', 'http://' . BADGE_BACKPACKURL);
$mform->addElement('hidden', 'backpackurl', BADGE_BACKPACKURL);
$mform->setType('backpackurl', PARAM_URL);

}
Expand Down Expand Up @@ -118,7 +118,7 @@ public function definition() {

$mform->addElement('header', 'backpackheader', get_string('backpackconnection', 'badges'));
$mform->addHelpButton('backpackheader', 'backpackconnection', 'badges');
$mform->addElement('static', 'url', get_string('url'), 'http://' . BADGE_BACKPACKURL);
$mform->addElement('static', 'url', get_string('url'), BADGE_BACKPACKURL);

$status = html_writer::tag('span', get_string('connected', 'badges'), array('class' => 'connected'));
$mform->addElement('static', 'status', get_string('status'), $status);
Expand Down
4 changes: 2 additions & 2 deletions badges/backpackconnect.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@

// Make sure email matches a backpack.
$check = new stdClass();
$check->backpackurl = 'http://' . BADGE_BACKPACKURL;
$check->backpackurl = BADGE_BACKPACKURL;
$check->email = $data->email;

$bp = new OpenBadgesBackpackHandler($check);
Expand All @@ -106,7 +106,7 @@
$obj = new stdClass();
$obj->userid = $USER->id;
$obj->email = $data->email;
$obj->backpackurl = 'http://' . BADGE_BACKPACKURL;
$obj->backpackurl = BADGE_BACKPACKURL;
$obj->backpackuid = $backpackuid;
$obj->autosync = 0;
$obj->password = '';
Expand Down
7 changes: 3 additions & 4 deletions lib/badgeslib.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
/*
* URL of backpack. Currently only the Open Badges backpack is supported.
*/
define('BADGE_BACKPACKURL', 'backpack.openbadges.org');
define('BADGE_BACKPACKURL', 'https://backpack.openbadges.org');

/**
* Class that represents badge.
Expand Down Expand Up @@ -1160,7 +1160,7 @@ function badges_check_backpack_accessibility() {
'HEADER' => 0,
'CONNECTTIMEOUT' => 2,
);
$location = 'http://' . BADGE_BACKPACKURL . '/baker';
$location = BADGE_BACKPACKURL . '/baker';
$out = $curl->get($location, array('assertion' => $fakeassertion->out(false)), $options);

$data = json_decode($out);
Expand Down Expand Up @@ -1228,8 +1228,7 @@ function badges_setup_backpack_js() {
global $CFG, $PAGE;
if (!empty($CFG->badges_allowexternalbackpack)) {
$PAGE->requires->string_for_js('error:backpackproblem', 'badges');
$protocol = (is_https()) ? 'https://' : 'http://';
$PAGE->requires->js(new moodle_url($protocol . BADGE_BACKPACKURL . '/issuer.js'), true);
$PAGE->requires->js(new moodle_url(BADGE_BACKPACKURL . '/issuer.js'), true);
$PAGE->requires->js('/badges/backpack.js', true);
}
}

0 comments on commit 4d0ebde

Please sign in to comment.