Commit 85895307 authored by Yuliya Bozhko's avatar Yuliya Bozhko
Browse files

MDL-51390 badges: Switch backpack URL to use HTTPS


Signed-off-by: default avatarYuliya Bozhko <yuliya.bozhko@totaralms.com>
parent 3377cbc3
......@@ -45,7 +45,7 @@ class edit_backpack_form extends moodleform {
$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);
......@@ -67,7 +67,7 @@ class edit_backpack_form extends moodleform {
$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);
}
......@@ -118,7 +118,7 @@ class edit_collections_form extends moodleform {
$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);
......
......@@ -87,7 +87,7 @@ if (!isset($data->status) || $data->status != 'okay') {
// 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);
......@@ -106,7 +106,7 @@ if (isset($request->status) && $request->status == 'missing') {
$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 = '';
......
......@@ -96,7 +96,7 @@ define('BADGE_MESSAGE_MONTHLY', 4);
/*
* 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.
......@@ -1193,7 +1193,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);
......@@ -1261,8 +1261,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);
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment