Merge branch 'MDL-57429-master' of https://github.com/snake/moodle
This commit is contained in:
@@ -44,86 +44,3 @@ function check_site_access() {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Update the status indicator to show connection progress.
|
||||
*/
|
||||
function badges_set_connection_progress(status) {
|
||||
switch (status) {
|
||||
case 'connecting':
|
||||
var connecting = M.util.get_string('connecting', 'badges');
|
||||
var imageurl = M.util.image_url('i/loading_small', 'moodle');
|
||||
var loading = Y.Node.create(connecting + ' <img src="'+imageurl+'" width="16" height="16" alt="'+connecting+'"/>');
|
||||
Y.one('#connection-status').removeClass('notconnected').addClass('connecting').setHTML(loading);
|
||||
break;
|
||||
case 'notconnected':
|
||||
var notconnected = M.util.get_string('notconnected', 'badges');;
|
||||
Y.one('#connection-status').removeClass('connecting').addClass('notconnected').setHTML(notconnected);
|
||||
break;
|
||||
default:
|
||||
// Unknown status, do nothing.
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Print an error message at the top of the page.
|
||||
*/
|
||||
function badges_set_error_message(messagekey, param) {
|
||||
var errortext = M.util.get_string(messagekey, 'badges', param);
|
||||
Y.one('#connection-error').setHTML(errortext);
|
||||
}
|
||||
|
||||
/*
|
||||
* Handle the assertion generated by the Persona dialog.
|
||||
*/
|
||||
function badges_handle_assertion(assertion) {
|
||||
|
||||
if (!assertion) {
|
||||
var noassertionstr = M.util.get_string('error:noassertion', 'badges');
|
||||
badges_set_error_message('error:backpackloginfailed', noassertionstr);
|
||||
return;
|
||||
}
|
||||
|
||||
badges_set_connection_progress('connecting');
|
||||
|
||||
Y.io("backpackconnect.php", {
|
||||
method: "POST",
|
||||
data: "assertion="+assertion+"&sesskey="+M.cfg.sesskey,
|
||||
on: {
|
||||
success: function (id, result) {
|
||||
// Reload page to display connected email address.
|
||||
window.location.href = "mybackpack.php";
|
||||
},
|
||||
failure: function (id, result) {
|
||||
try {
|
||||
var parsedResponse = Y.JSON.parse(result.response);
|
||||
} catch (e) {
|
||||
badges_set_connection_progress('notconnected');
|
||||
var badjsonstr = M.util.get_string('error:badjson', 'badges');
|
||||
badges_set_error_message('error:backpackloginfailed', badjsonstr);
|
||||
return;
|
||||
}
|
||||
badges_set_connection_progress('notconnected');
|
||||
badges_set_error_message('error:backpackloginfailed', parsedResponse.reason);
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Create and bind the persona login button.
|
||||
*/
|
||||
function badges_init_persona_login_button() {
|
||||
// Create the login button and add to the page via Javascript.
|
||||
var imageurl = M.util.image_url('i/persona_sign_in_black', 'moodle');
|
||||
var imagealt = M.util.get_string('signinwithyouremail', 'badges');
|
||||
var button = Y.Node.create('<img id="persona_signin" src="'+imageurl+'" width="202" height="25" alt="'+imagealt+'"/>');
|
||||
Y.one('#persona-container').append(button);
|
||||
|
||||
// Bind a click event to trigger login when clicked.
|
||||
button.on('click', function() {
|
||||
Y.one('#connection-error').empty();
|
||||
navigator.id.get(badges_handle_assertion);
|
||||
});
|
||||
}
|
||||
|
||||
+40
-25
@@ -46,23 +46,6 @@ class edit_backpack_form extends moodleform {
|
||||
$mform->addElement('header', 'backpackheader', get_string('backpackconnection', 'badges'));
|
||||
$mform->addHelpButton('backpackheader', 'backpackconnection', 'badges');
|
||||
$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);
|
||||
|
||||
$nojs = html_writer::tag('noscript', get_string('error:personaneedsjs', 'badges'),
|
||||
array('class' => 'notconnected'));
|
||||
$personadiv = $OUTPUT->container($nojs, null, 'persona-container');
|
||||
|
||||
$mform->addElement('static', 'persona', '', $personadiv);
|
||||
$mform->addHelpButton('persona', 'personaconnection', 'badges');
|
||||
|
||||
$PAGE->requires->js(new moodle_url('https://login.persona.org/include.js'));
|
||||
$PAGE->requires->js('/badges/backpack.js');
|
||||
$PAGE->requires->js_init_call('badges_init_persona_login_button', null, false);
|
||||
$PAGE->requires->strings_for_js(array('error:backpackloginfailed', 'signinwithyouremail',
|
||||
'error:noassertion', 'error:connectionunknownreason', 'error:badjson', 'connecting',
|
||||
'notconnected'), 'badges');
|
||||
|
||||
$mform->addElement('hidden', 'userid', $USER->id);
|
||||
$mform->setType('userid', PARAM_INT);
|
||||
@@ -70,23 +53,55 @@ class edit_backpack_form extends moodleform {
|
||||
$mform->addElement('hidden', 'backpackurl', BADGE_BACKPACKURL);
|
||||
$mform->setType('backpackurl', PARAM_URL);
|
||||
|
||||
if (isset($this->_customdata['email'])) {
|
||||
// Email will be passed in when we're in the process of verifying the user's email address,
|
||||
// so set the connection status, lock the email field, and provide options to resend the verification
|
||||
// email or cancel the verification process entirely and start over.
|
||||
$status = html_writer::tag('span', get_string('backpackemailverificationpending', 'badges'),
|
||||
array('class' => 'notconnected', 'id' => 'connection-status'));
|
||||
$mform->addElement('static', 'status', get_string('status'), $status);
|
||||
$mform->addElement('hidden', 'email', $this->_customdata['email']);
|
||||
$mform->setType('email', PARAM_RAW_TRIMMED);
|
||||
$mform->hardFreeze(['email']);
|
||||
$status = html_writer::tag('span', $this->_customdata['email'], []);
|
||||
$mform->addElement('static', 'emailverify', get_string('email'), $status);
|
||||
$buttonarray = [];
|
||||
$buttonarray[] = &$mform->createElement('submit', 'submitbutton',
|
||||
get_string('backpackconnectionresendemail', 'badges'));
|
||||
$buttonarray[] = &$mform->createElement('submit', 'revertbutton',
|
||||
get_string('backpackconnectioncancelattempt', 'badges'));
|
||||
$mform->addGroup($buttonarray, 'buttonar', '', [''], false);
|
||||
$mform->closeHeaderBefore('buttonar');
|
||||
} else {
|
||||
// Email isn't present, so provide an input element to get it and a button to start the verification process.
|
||||
$status = html_writer::tag('span', get_string('notconnected', 'badges'),
|
||||
array('class' => 'notconnected', 'id' => 'connection-status'));
|
||||
$mform->addElement('static', 'status', get_string('status'), $status);
|
||||
$mform->addElement('text', 'email', get_string('email'), 'maxlength="100" size="30"');
|
||||
$mform->addHelpButton('email', 'backpackemail', 'badges');
|
||||
$mform->addRule('email', get_string('required'), 'required', null, 'client');
|
||||
$mform->setType('email', PARAM_RAW_TRIMMED);
|
||||
$this->add_action_buttons(false, get_string('backpackconnectionconnect', 'badges'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates form data
|
||||
*/
|
||||
public function validation($data, $files) {
|
||||
global $DB;
|
||||
$errors = parent::validation($data, $files);
|
||||
|
||||
$check = new stdClass();
|
||||
$check->backpackurl = $data['backpackurl'];
|
||||
$check->email = $data['email'];
|
||||
// We don't need to verify the email address if we're clearing a pending email verification attempt.
|
||||
if (!isset($data['revertbutton'])) {
|
||||
$check = new stdClass();
|
||||
$check->backpackurl = $data['backpackurl'];
|
||||
$check->email = $data['email'];
|
||||
|
||||
$bp = new OpenBadgesBackpackHandler($check);
|
||||
$request = $bp->curl_request('user');
|
||||
if (isset($request->status) && $request->status == 'missing') {
|
||||
$errors['email'] = get_string('error:nosuchuser', 'badges');
|
||||
$bp = new OpenBadgesBackpackHandler($check);
|
||||
$request = $bp->curl_request('user');
|
||||
if (isset($request->status) && $request->status == 'missing') {
|
||||
$errors['email'] = get_string('error:nosuchuser', 'badges');
|
||||
}
|
||||
}
|
||||
return $errors;
|
||||
}
|
||||
|
||||
@@ -1,138 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* AJAX script for validating backpack connection.
|
||||
*
|
||||
* @package core
|
||||
* @subpackage badges
|
||||
* @copyright 2012 onwards Totara Learning Solutions Ltd {@link http://www.totaralms.com/}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @author Simon Coggins <[email protected]>
|
||||
*/
|
||||
|
||||
define('AJAX_SCRIPT', true);
|
||||
|
||||
require_once(__DIR__ . '/../config.php');
|
||||
require_once($CFG->dirroot . '/badges/lib/backpacklib.php');
|
||||
require_once($CFG->libdir . '/filelib.php');
|
||||
require_once($CFG->libdir . '/badgeslib.php');
|
||||
|
||||
require_sesskey();
|
||||
require_login();
|
||||
$PAGE->set_url('/badges/backpackconnect.php');
|
||||
$PAGE->set_context(context_system::instance());
|
||||
echo $OUTPUT->header();
|
||||
|
||||
// Use PHP input filtering as there is no PARAM type for
|
||||
// the type of cleaning that is required (ASCII chars 32-127 only).
|
||||
$assertion = filter_input(
|
||||
INPUT_POST,
|
||||
'assertion',
|
||||
FILTER_UNSAFE_RAW,
|
||||
FILTER_FLAG_STRIP_LOW|FILTER_FLAG_STRIP_HIGH
|
||||
);
|
||||
|
||||
// Audience is the site url scheme + host + port only.
|
||||
$wwwparts = parse_url($CFG->wwwroot);
|
||||
$audience = $wwwparts['scheme'] . '://' . $wwwparts['host'];
|
||||
$audience .= isset($wwwparts['port']) ? ':' . $wwwparts['port'] : '';
|
||||
$params = 'assertion=' . urlencode($assertion) . '&audience=' .
|
||||
urlencode($audience);
|
||||
|
||||
$curl = new curl();
|
||||
$url = 'https://verifier.login.persona.org/verify';
|
||||
$options = array(
|
||||
'FRESH_CONNECT' => true,
|
||||
'RETURNTRANSFER' => true,
|
||||
'FORBID_REUSE' => true,
|
||||
'SSL_VERIFYPEER' => true,
|
||||
'SSL_VERIFYHOST' => 2,
|
||||
'HEADER' => 0,
|
||||
'HTTPHEADER' => array('Content-type: application/x-www-form-urlencoded'),
|
||||
'CONNECTTIMEOUT' => 0,
|
||||
'TIMEOUT' => 10, // Fail if data not returned within 10 seconds.
|
||||
);
|
||||
$result = $curl->post($url, $params, $options);
|
||||
|
||||
// Handle time-out and failed request.
|
||||
if ($curl->errno != 0) {
|
||||
if ($curl->errno == CURLE_OPERATION_TIMEOUTED) {
|
||||
$reason = get_string('error:requesttimeout', 'badges');
|
||||
} else {
|
||||
$reason = get_string('error:requesterror', 'badges', $curl->errno);
|
||||
}
|
||||
badges_send_response('failure', $reason);
|
||||
}
|
||||
|
||||
$data = json_decode($result);
|
||||
|
||||
if (!isset($data->status) || $data->status != 'okay') {
|
||||
$reason = isset($data->reason) ? $data->reason : get_string('error:connectionunknownreason', 'badges');
|
||||
badges_send_response('failure', $reason);
|
||||
}
|
||||
|
||||
// Make sure email matches a backpack.
|
||||
$check = new stdClass();
|
||||
$check->backpackurl = BADGE_BACKPACKURL;
|
||||
$check->email = $data->email;
|
||||
|
||||
$bp = new OpenBadgesBackpackHandler($check);
|
||||
$request = $bp->curl_request('user');
|
||||
if (isset($request->status) && $request->status == 'missing') {
|
||||
$reason = get_string('error:backpackemailnotfound', 'badges', $data->email);
|
||||
badges_send_response('failure', $reason);
|
||||
} else if (empty($request->userId)) {
|
||||
$reason = get_string('error:backpackdatainvalid', 'badges');
|
||||
badges_send_response('failure', $reason);
|
||||
} else {
|
||||
$backpackuid = $request->userId;
|
||||
}
|
||||
|
||||
// Insert record.
|
||||
$obj = new stdClass();
|
||||
$obj->userid = $USER->id;
|
||||
$obj->email = $data->email;
|
||||
$obj->backpackurl = BADGE_BACKPACKURL;
|
||||
$obj->backpackuid = $backpackuid;
|
||||
$obj->autosync = 0;
|
||||
$obj->password = '';
|
||||
$DB->insert_record('badge_backpack', $obj);
|
||||
|
||||
// Return success indicator and email address.
|
||||
badges_send_response('success', $data->email);
|
||||
|
||||
|
||||
/**
|
||||
* Return a JSON response containing the response provided.
|
||||
*
|
||||
* @param string $status Status of the response, typically 'success' or 'failure'.
|
||||
* @param string $responsetext On success, the email address of the user,
|
||||
* otherwise a reason for the failure.
|
||||
* @return void Outputs the JSON and terminates the script.
|
||||
*/
|
||||
function badges_send_response($status, $responsetext) {
|
||||
$out = new stdClass();
|
||||
$out->status = $status;
|
||||
if ($status == 'success') {
|
||||
$out->email = $responsetext;
|
||||
} else {
|
||||
$out->reason = $responsetext;
|
||||
send_header_404();
|
||||
}
|
||||
echo json_encode($out);
|
||||
exit;
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Endpoint for the verification email link.
|
||||
*
|
||||
* @package core
|
||||
* @subpackage badges
|
||||
* @copyright 2016 Jake Dallimore <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
require_once(__DIR__ . '/../config.php');
|
||||
require_once($CFG->libdir . '/badgeslib.php');
|
||||
require_once(__DIR__ . '/lib/backpacklib.php');
|
||||
|
||||
$data = optional_param('data', '', PARAM_RAW);
|
||||
require_login();
|
||||
$PAGE->set_url('/badges/openbackpackemailverify.php');
|
||||
$PAGE->set_context(context_user::instance($USER->id));
|
||||
$redirect = '/badges/mybackpack.php';
|
||||
|
||||
// Confirm the secret and create the backpack connection.
|
||||
$storedsecret = get_user_preferences('badges_email_verify_secret');
|
||||
if (!is_null($storedsecret)) {
|
||||
if ($data === $storedsecret) {
|
||||
$storedemail = get_user_preferences('badges_email_verify_address');
|
||||
|
||||
$data = new stdClass();
|
||||
$data->backpackurl = BADGE_BACKPACKURL;
|
||||
$data->email = $storedemail;
|
||||
$bp = new OpenBadgesBackpackHandler($data);
|
||||
|
||||
$obj = new stdClass();
|
||||
$obj->userid = $USER->id;
|
||||
$obj->email = $data->email;
|
||||
$obj->backpackurl = $data->backpackurl;
|
||||
$obj->backpackuid = $bp->curl_request('user')->userId;
|
||||
$obj->autosync = 0;
|
||||
$obj->password = '';
|
||||
$DB->insert_record('badge_backpack', $obj);
|
||||
|
||||
// Remove the verification vars and redirect to the mypackpack page.
|
||||
unset_user_preference('badges_email_verify_secret');
|
||||
unset_user_preference('badges_email_verify_address');
|
||||
redirect(new moodle_url($redirect), get_string('backpackemailverifysuccess', 'badges'),
|
||||
null, \core\output\notification::NOTIFY_SUCCESS);
|
||||
} else {
|
||||
// Stored secret doesn't match the supplied secret. Take user back to the mybackpack page and present a warning message.
|
||||
redirect(new moodle_url($redirect), get_string('backpackemailverifytokenmismatch', 'badges'),
|
||||
null, \core\output\notification::NOTIFY_ERROR);
|
||||
}
|
||||
} else {
|
||||
// Stored secret is null. Either the email address has already been verified, or there is no record of a verification attempt
|
||||
// for the current user. Either way, just redirect to the mybackpack page.
|
||||
redirect(new moodle_url($redirect));
|
||||
}
|
||||
@@ -117,3 +117,45 @@ class OpenBadgesBackpackHandler {
|
||||
return $this->backpack;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create and send a verification email to the email address supplied.
|
||||
*
|
||||
* Since we're not sending this email to a user, email_to_user can't be used
|
||||
* but this function borrows largely the code from that process.
|
||||
*
|
||||
* @param string $email the email address to send the verification email to.
|
||||
* @return true if the email was sent successfully, false otherwise.
|
||||
*/
|
||||
function send_verification_email($email) {
|
||||
global $DB, $USER;
|
||||
|
||||
// Store a user secret (badges_email_verify_secret) and the address (badges_email_verify_address) as users prefs.
|
||||
// The address will be used by edit_backpack_form for display during verification and to facilitate the resending
|
||||
// of verification emails to said address.
|
||||
$secret = random_string(15);
|
||||
set_user_preference('badges_email_verify_secret', $secret);
|
||||
set_user_preference('badges_email_verify_address', $email);
|
||||
|
||||
// To, from.
|
||||
$tempuser = $DB->get_record('user', array('id' => $USER->id), '*', MUST_EXIST);
|
||||
$tempuser->email = $email;
|
||||
$noreplyuser = core_user::get_noreply_user();
|
||||
|
||||
// Generate the verification email body.
|
||||
$verificationurl = '/badges/backpackemailverify.php';
|
||||
$verificationurl = new moodle_url($verificationurl);
|
||||
$verificationpath = $verificationurl->out(false);
|
||||
|
||||
$site = get_site();
|
||||
$args = new stdClass();
|
||||
$args->link = $verificationpath . '?data='. $secret;
|
||||
$args->sitename = $site->fullname;
|
||||
$args->admin = generate_email_signoff();
|
||||
|
||||
$messagesubject = get_string('backpackemailverifyemailsubject', 'badges', $site->fullname);
|
||||
$messagetext = get_string('backpackemailverifyemailbody', 'badges', $args);
|
||||
$messagehtml = text_to_html($messagetext, false, false, true);
|
||||
|
||||
return email_to_user($tempuser, $noreplyuser, $messagesubject, $messagetext, $messagehtml);
|
||||
}
|
||||
|
||||
+29
-13
@@ -110,23 +110,39 @@ if ($backpack) {
|
||||
}
|
||||
} else {
|
||||
// If backpack is not connected, need to connect first.
|
||||
$form = new edit_backpack_form();
|
||||
// To create a new connection to the backpack, first we need to verify the user's email address:
|
||||
// 1. User enters email and clicks 'Connect to backpack'.
|
||||
// 2. After cross-checking the email address against the backpack provider, an email is sent to the specified address,
|
||||
// and the email and secret are stored in user preferences. These will be cleared upon successful verification.
|
||||
// 3. User clicks verification link in the email to confirm the backpack connection.
|
||||
// 4. User redirected to the mybackpack page.
|
||||
// While the verification process is pending, the edit_backpack_form form will present the user with options to resend the
|
||||
// verification email, and to cancel the current verification attempt and start over.
|
||||
|
||||
// To pass through the current state of the verification attempt to the form.
|
||||
$params['email'] = get_user_preferences('badges_email_verify_address');
|
||||
|
||||
$form = new edit_backpack_form(new moodle_url('/badges/mybackpack.php'), $params);
|
||||
if ($form->is_cancelled()) {
|
||||
redirect(new moodle_url('/badges/mybadges.php'));
|
||||
} else if ($data = $form->get_data()) {
|
||||
$bp = new OpenBadgesBackpackHandler($data);
|
||||
|
||||
$obj = new stdClass();
|
||||
$obj->userid = $data->userid;
|
||||
$obj->email = $data->email;
|
||||
$obj->backpackurl = $data->backpackurl;
|
||||
$obj->backpackuid = $bp->curl_request('user')->userId;
|
||||
$obj->autosync = 0;
|
||||
$obj->password = '';
|
||||
$DB->insert_record('badge_backpack', $obj);
|
||||
|
||||
redirect(new moodle_url('/badges/mybackpack.php'));
|
||||
// The form may have been submitted under one of the following circumstances:
|
||||
// 1. After clicking 'Connect to backpack'. We'll have $data->email.
|
||||
// 2. After clicking 'Resend verification email'. We'll have $data->email.
|
||||
// 3. After clicking 'Connect using a different email' to cancel the verification process. We'll have $data->revertbutton.
|
||||
if (isset($data->revertbutton)) {
|
||||
unset_user_preference('badges_email_verify_secret');
|
||||
unset_user_preference('badges_email_verify_address');
|
||||
redirect(new moodle_url('/badges/mybackpack.php'));
|
||||
} else if (isset($data->email)) {
|
||||
if (send_verification_email($data->email)) {
|
||||
redirect(new moodle_url('/badges/mybackpack.php'),
|
||||
get_string('backpackemailverifypending', 'badges', $data->email),
|
||||
null, \core\output\notification::NOTIFY_INFO);
|
||||
} else {
|
||||
print_error ('backpackcannotsendverification', 'badges');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+30
-8
@@ -79,17 +79,34 @@ You should fix this issue on any production site where you are planning to issue
|
||||
|
||||
The only URL required for verification is [your-site-url]/badges/assertion.php so if you are able to modify your firewall to allow external access to that file, badge verification will still work.';
|
||||
$string['backpackbadges'] = 'You have {$a->totalbadges} badge(s) displayed from {$a->totalcollections} collection(s). <a href="mybackpack.php">Change backpack settings</a>.';
|
||||
$string['backpackcannotsendverification'] = 'Cannot send verification email';
|
||||
$string['backpackconnection'] = 'Backpack connection';
|
||||
$string['backpackconnection_help'] = 'This page allows you to set up connection to an external backpack provider. Connecting to a backpack lets you display external badges within this site and push badges earned here to your backpack.
|
||||
|
||||
Currently, only <a href="http://backpack.openbadges.org">Mozilla OpenBadges Backpack</a> is supported. You need to sign up for a backpack service before trying to set up backpack connection on this page.';
|
||||
$string['backpackconnectioncancelattempt'] = 'Connect using a different email address';
|
||||
$string['backpackconnectionconnect'] = 'Connect to Backpack';
|
||||
$string['backpackconnectionresendemail'] = 'Resend verification email';
|
||||
$string['backpackdetails'] = 'Backpack settings';
|
||||
$string['backpackemail'] = 'Email address';
|
||||
$string['backpackemail_help'] = 'The email address associated with your backpack. While you are connected, any badges earned on this site will be associated with this email address.';
|
||||
$string['personaconnection'] = 'Sign in with your email';
|
||||
$string['personaconnection_help'] = 'Persona is a system for identifying yourself across the web, using an email address that you own. The Open Badges backpack uses Persona as a login system, so to be able to connect to a backpack you will need a Persona account.
|
||||
$string['backpackemailverificationpending'] = 'Verification pending';
|
||||
$string['backpackemailverifyemailbody'] = 'Hi,
|
||||
|
||||
For more information about Persona visit <a href="https://login.persona.org/about">https://login.persona.org/about</a>.';
|
||||
A new connection to your OpenBadges backpack has been requested from \'{$a->sitename}\' using your email address.
|
||||
|
||||
To confirm and activate the connection to your backpack, please click the link below.
|
||||
|
||||
{$a->link}
|
||||
|
||||
In most mail programs, this should appear as a blue link which you can just click on. If that doesn\'t work, then cut and paste the address into the address line at the top of your web browser.
|
||||
|
||||
If you need help, please contact the site administrator,
|
||||
{$a->admin}';
|
||||
$string['backpackemailverifyemailsubject'] = '{$a}: OpenBadges Backpack email verification';
|
||||
$string['backpackemailverifypending'] = 'A verification email has been sent to <strong>{$a}</strong>. Click on the verification link in the email to activate your Backpack connection.';
|
||||
$string['backpackemailverifysuccess'] = 'Thanks for verifying your email address. You are now connected to your Backpack.';
|
||||
$string['backpackemailverifytokenmismatch'] = 'The token in the link you clicked does not match the stored token. Make sure you clicked the link in most recent email you received.';
|
||||
$string['backpackimport'] = 'Badge import settings';
|
||||
$string['backpackimport_help'] = 'After the backpack connection is successfully established, badges from your backpack can be displayed on your badges page and your profile page.
|
||||
|
||||
@@ -214,11 +231,9 @@ $string['enablebadges'] = 'Enable badges';
|
||||
$string['error:backpackdatainvalid'] = 'The data return from the backpack was invalid.';
|
||||
$string['error:backpackemailnotfound'] = 'The email \'{$a}\' is not associated with a backpack. You need to <a href="http://backpack.openbadges.org">create a backpack</a> for that account or sign in with another email address.';
|
||||
$string['error:backpacknotavailable'] = 'Your site is not accessible from the Internet, so any badges issued from this site cannot be verified by external backpack services.';
|
||||
$string['error:backpackloginfailed'] = 'You could not be connected to an external backpack for the following reason: {$a}';
|
||||
$string['error:backpackproblem'] = 'There was a problem connecting to your backpack service provider. Please try again later.';
|
||||
$string['error:badgeawardnotfound'] = 'Cannot verify this awarded badge. This badge may have been revoked.';
|
||||
$string['error:badgenotfound'] = 'Badge not found';
|
||||
$string['error:badjson'] = 'The connection attempt returned invalid data.';
|
||||
$string['error:cannotact'] = 'Cannot activate the badge. ';
|
||||
$string['error:cannotawardbadge'] = 'Cannot award badge to a user.';
|
||||
$string['error:cannotrevokebadge'] = 'Cannot revoke badge from a user.';
|
||||
@@ -233,7 +248,6 @@ $string['error:invalidcriteriatype'] = 'Invalid criteria type.';
|
||||
$string['error:invalidexpiredate'] = 'Expiry date has to be in the future.';
|
||||
$string['error:invalidexpireperiod'] = 'Expiry period cannot be negative or equal 0.';
|
||||
$string['error:noactivities'] = 'There are no activities with completion criteria enabled in this course.';
|
||||
$string['error:noassertion'] = 'No assertion was returned by Persona. You may have closed the dialog before completing the login process.';
|
||||
$string['error:nocourses'] = 'Course completion is not enabled for any of the courses in this site, so none can be displayed. Course completion may be enabled in the course settings.';
|
||||
$string['error:nogroups'] = '<p>There are no public collections of badges available in your backpack. </p>
|
||||
<p>Only public collections are shown, <a href="http://backpack.openbadges.org">visit your backpack</a> to create some public collections.</p>';
|
||||
@@ -246,7 +260,6 @@ $string['error:nosuchrole'] = 'Warning: This role is no longer available.';
|
||||
$string['error:nosuchuser'] = 'User with this email address does not have an account with the current backpack provider.';
|
||||
$string['error:notifycoursedate'] = 'Warning: Badges associated with course and activity completions will not be issued until the course start date.';
|
||||
$string['error:parameter'] = 'Warning: At least one parameter should be selected to ensure correct badge issuing workflow.';
|
||||
$string['error:personaneedsjs'] = 'Currently, Javascript is required to connect to your backpack. If you can, enable Javascript and reload the page.';
|
||||
$string['error:requesttimeout'] = 'The connection request timed out before it could complete.';
|
||||
$string['error:requesterror'] = 'The connection request failed (error code {$a}).';
|
||||
$string['error:save'] = 'Cannot save the badge.';
|
||||
@@ -370,7 +383,6 @@ $string['selectgroup_end'] = 'Only public collections are shown, <a href="http:/
|
||||
$string['selectgroup_start'] = 'Select collections from your backpack to display on this site:';
|
||||
$string['selecting'] = 'With selected badges...';
|
||||
$string['setup'] = 'Set up connection';
|
||||
$string['signinwithyouremail'] = 'Sign in with your email';
|
||||
$string['sitebadges'] = 'Site badges';
|
||||
$string['sitebadges_help'] = 'Site badges can only be awarded to users for site-related activities. These include completing a set of courses or parts of user profiles. Site badges can also be issued manually by one user to another.
|
||||
|
||||
@@ -409,3 +421,13 @@ $string['visible'] = 'Visible';
|
||||
$string['warnexpired'] = ' (This badge has expired!)';
|
||||
$string['year'] = 'Year(s)';
|
||||
|
||||
// Deprecated since Moodle 3.3.
|
||||
$string['personaconnection'] = 'Sign in with your email';
|
||||
$string['personaconnection_help'] = 'Persona is a system for identifying yourself across the web, using an email address that you own. The Open Badges backpack uses Persona as a login system, so to be able to connect to a backpack you will need a Persona account.
|
||||
|
||||
For more information about Persona visit <a href="https://login.persona.org/about">https://login.persona.org/about</a>.';
|
||||
$string['error:backpackloginfailed'] = 'You could not be connected to an external backpack for the following reason: {$a}';
|
||||
$string['error:badjson'] = 'The connection attempt returned invalid data.';
|
||||
$string['error:noassertion'] = 'No assertion was returned by Persona. You may have closed the dialog before completing the login process.';
|
||||
$string['error:personaneedsjs'] = 'Currently, Javascript is required to connect to your backpack. If you can, enable Javascript and reload the page.';
|
||||
$string['signinwithyouremail'] = 'Sign in with your email';
|
||||
|
||||
@@ -61,4 +61,11 @@ timesent,core_message
|
||||
userssearchresults,core_message
|
||||
loginpasswordautocomplete,core_admin
|
||||
loginpasswordautocomplete_help,core_admin
|
||||
deletecomment,core
|
||||
deletecomment,core
|
||||
personaconnection,core_badges
|
||||
personaconnection_help,core_badges
|
||||
error:noassertion,core_badges
|
||||
error:personaneedsjs,core_badges
|
||||
error:badjson,core_badges
|
||||
error:backpackloginfailed,core_badges
|
||||
signinwithyouremail,core_badges
|
||||
Reference in New Issue
Block a user