Skip to content

Commit 0c76785

Browse files
committed
Issue #1443700 by colan: Fixed bad log reporting for missing SAML username.
1 parent 8e371fe commit 0c76785

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

simplesamlphp_auth.module

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -367,9 +367,8 @@ function simplesamlphp_auth_user_insert(&$edit, $account, $category = NULL) {
367367
$account->name = _simplesamlphp_auth_get_default_name($account->uid);
368368
}
369369
catch (Exception $e) {
370-
$message = t('Username is missing.' . $e->getMessage());
371-
drupal_set_message(check_plain($message), "error");
372-
watchdog('simplesamlphp', $message, WATCHDOG_CRITICAL);
370+
drupal_set_message(t('Your user name was not provided by your identity provider (IDP).'), "error");
371+
watchdog('simplesamlphp_auth', $e->getMessage(), NULL, WATCHDOG_CRITICAL);
373372
}
374373

375374
db_update('users')
@@ -385,7 +384,7 @@ function simplesamlphp_auth_user_insert(&$edit, $account, $category = NULL) {
385384
}
386385
catch (Exception $e) {
387386
drupal_set_message(t('Your e-mail address was not provided by your identity provider (IDP).'), "error");
388-
watchdog('simplesamlphp_auth', $e->getMessage(), WATCHDOG_CRITICAL);
387+
watchdog('simplesamlphp_auth', $e->getMessage(), NULL, WATCHDOG_CRITICAL);
389388
}
390389

391390
if (!empty($mail_address)) {
@@ -745,7 +744,11 @@ function _simplesamlphp_auth_get_default_name($account) {
745744
if ((!isset($_simplesamlphp_auth_saml_attributes[$auth_user_name_attr])) ||
746745
(!isset($_simplesamlphp_auth_saml_attributes[$auth_user_name_attr][0])) ||
747746
($_simplesamlphp_auth_saml_attributes[$auth_user_name_attr][0] == '')) {
748-
throw new Exception(t('There was no attribute named %auth_user_name_attr set for your user.', array('%auth_user_name_attr' => $auth_user_name_attr)));
747+
throw new Exception(t('There was no set attribute named "%auth_user_name_attr" returned for user %uid.',
748+
array(
749+
'%auth_user_name_attr' => $auth_user_name_attr,
750+
'%uid' => $account,
751+
)));
749752
}
750753
$default_name = $_simplesamlphp_auth_saml_attributes[$auth_user_name_attr][0];
751754
}

0 commit comments

Comments
 (0)