Index: webserver_auth.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/webserver_auth/Attic/webserver_auth.module,v retrieving revision 1.22.2.1 diff -u -d -F^\s*function -r1.22.2.1 webserver_auth.module --- webserver_auth.module 7 Aug 2008 16:38:49 -0000 1.22.2.1 +++ webserver_auth.module 15 Aug 2008 20:16:11 -0000 @@ -47,7 +84,7 @@ function webserver_auth_init() { else { if (!empty($authname)) { // User is logged into webserver via HTTP authentication. - // Try to log into Drupal. + // Try to log into Drupal. $user = user_external_load($authname); if (!$user) { @@ -74,12 +111,17 @@ function webserver_auth_user($op, &$edit // Get 'foo' from 'foo@bar' $account->name = array_shift(explode('@', $account->name)); } + + // Update the username and copy the change to $edit so that other modules + // also use the new name. db_query("UPDATE {users} SET name = '%s' WHERE uid = %d", $account->name, $account->uid); + $edit['name'] = $account->name; + // Generate an e-mail address automagically - if ($domain = variable_get('webserver_auth_email_domain', '')) { - if ($account->name) { - db_query("UPDATE {users} SET mail = '%s@%s' WHERE uid = %d", $account->name, $domain, $account->uid); - } + if (($domain = variable_get('webserver_auth_email_domain', '')) && $account->name) { + $account->mail = $account->name .'@'. $domain; + db_query("UPDATE {users} SET mail = '%s' WHERE uid = %d", $account->mail, $account->uid); + $edit['mail'] = $account->mail; } // run some custom code to modify the user object at creation time if ($code = variable_get('webserver_auth_insert', '')) {