Auth: Better error message when SSO fails

This commit is contained in:
donal72 2007-01-11 04:16:34 +00:00
parent 1ca484a3b7
commit 016bac47b7
2 changed files with 13 additions and 2 deletions

View File

@ -233,14 +233,21 @@ class auth_plugin_mnet
if ($mnetrequest->send($remotepeer) === true) {
$remoteuser = (object) $mnetrequest->response;
} else {
foreach ($mnetrequest->error as $code => $errormessage) {
foreach ($mnetrequest->error as $errormessage) {
list($code, $message) = array_map('trim',explode(':', $errormessage, 2));
if($code == 702) {
$site = get_site();
print_error('mnet_session_prohibited','mnet', $remotewwwroot, $site->fullname);
exit;
}
$message .= "ERROR $code:<br/>$errormessage<br/>";
}
error("RPC auth/mnet/user_authorise:<br/>$message");
}
if (empty($remoteuser) or empty($remoteuser->username)) {
error(get_string('unknownerror', 'mnet'));
print_error('unknownerror', 'mnet');
exit;
}
// get the local record for the remote user

View File

@ -15,6 +15,10 @@
require_once dirname(dirname(dirname(__FILE__))) . '/config.php';
require_once $CFG->dirroot . '/mnet/xmlrpc/client.php';
if (!$site = get_site()) {
print_error('mnet_session_prohibited', 'mnet', '', '');
}
// grab the GET params
$token = required_param('token', PARAM_BASE64);
$remotewwwroot = required_param('idp', PARAM_URL);