From af402e56772d500a72ca9719a74783c592d84cbe Mon Sep 17 00:00:00 2001 From: Michael Aherne Date: Wed, 17 Oct 2012 12:37:43 +0100 Subject: [PATCH] MDL-36101 auth_shibboleth Show appropriate error message for suspended accounts --- auth/shibboleth/index.php | 7 ++++--- auth/shibboleth/lang/en/auth_shibboleth.php | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/auth/shibboleth/index.php b/auth/shibboleth/index.php index 051ac4f5c17db..6a760ec5753b3 100644 --- a/auth/shibboleth/index.php +++ b/auth/shibboleth/index.php @@ -41,9 +41,9 @@ /// Check if the user has actually submitted login data to us - if ($shibbolethauth->user_login($frm->username, $frm->password)) { + if ($shibbolethauth->user_login($frm->username, $frm->password) + && $user = authenticate_user_login($frm->username, $frm->password)) { - $user = authenticate_user_login($frm->username, $frm->password); enrol_check_plugins($user); session_set_user($user); @@ -87,7 +87,8 @@ } else { - // For some weird reason the Shibboleth user couldn't be authenticated + // The Shibboleth user couldn't be mapped to a valid Moodle user + print_error('shib_invalid_account_error', 'auth_shibboleth'); } } diff --git a/auth/shibboleth/lang/en/auth_shibboleth.php b/auth/shibboleth/lang/en/auth_shibboleth.php index ca0f25126728e..aace9a12882ac 100644 --- a/auth/shibboleth/lang/en/auth_shibboleth.php +++ b/auth/shibboleth/lang/en/auth_shibboleth.php @@ -51,6 +51,7 @@ $string['auth_shib_only'] = 'Shibboleth only'; $string['auth_shib_only_description'] = 'Check this option if a Shibboleth authentication shall be enforced'; $string['auth_shib_username_description'] = 'Name of the webserver Shibboleth environment variable that shall be used as Moodle username'; +$string['shib_invalid_account_error'] = 'You seem to be Shibboleth authenticated but Moodle has no valid account for your username. Your account may not exist or it may have been suspended.'; $string['shib_no_attributes_error'] = 'You seem to be Shibboleth authenticated but Moodle didn\'t receive any user attributes. Please check that your Identity Provider releases the necessary attributes ({$a}) to the Service Provider Moodle is running on or inform the webmaster of this server.'; $string['shib_not_all_attributes_error'] = 'Moodle needs certain Shibboleth attributes which are not present in your case. The attributes are: {$a}
Please contact the webmaster of this server or your Identity Provider.'; $string['shib_not_set_up_error'] = 'Shibboleth authentication doesn\'t seem to be set up correctly because no Shibboleth environment variables are present for this page. Please consult the README for further instructions on how to set up Shibboleth authentication or contact the webmaster of this Moodle installation.';