From 016bac47b7e94e5044b003a7c5991a33f19d8449 Mon Sep 17 00:00:00 2001 From: donal72 Date: Thu, 11 Jan 2007 04:16:34 +0000 Subject: [PATCH] Auth: Better error message when SSO fails --- auth/mnet/auth.php | 11 +++++++++-- auth/mnet/land.php | 4 ++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/auth/mnet/auth.php b/auth/mnet/auth.php index 4b675fd308f..7e0307bac39 100644 --- a/auth/mnet/auth.php +++ b/auth/mnet/auth.php @@ -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:
$errormessage
"; } error("RPC auth/mnet/user_authorise:
$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 diff --git a/auth/mnet/land.php b/auth/mnet/land.php index 5350f56c824..4c58f2e3300 100644 --- a/auth/mnet/land.php +++ b/auth/mnet/land.php @@ -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);