diff --git a/CASAuth.php b/CASAuth.php index 1f2f91f..5d99e90 100644 --- a/CASAuth.php +++ b/CASAuth.php @@ -110,7 +110,6 @@ function casLogin($user, &$result) { // Get username $username = casNameLookup(phpCAS::getUser()); - $email = casEmailLookup(phpCAS::getUser()); // If we are restricting users AND the user is not in // the allowed users list, lets block the login @@ -127,9 +126,12 @@ function casLogin($user, &$result) { // Create a new account if the user does not exists if ($u->getID() == 0 && $CASAuth["CreateAccounts"]) { + //Get email and realname + $realname = casRealNameLookup(phpCAS::getUser()); + $email = casEmailLookup(phpCAS::getUser()); // Create the user $u->addToDatabase(); - $u->setRealName($username); + $u->setRealName($realname); $u->setEmail($email); // PwdSecret is used to salt the username, which is // then used to create an md5 hash which becomes the diff --git a/CASAuthSettings.php.template b/CASAuthSettings.php.template index 0d7246e..57ee1e4 100644 --- a/CASAuthSettings.php.template +++ b/CASAuthSettings.php.template @@ -95,6 +95,14 @@ function casNameLookup($username) { return $username; } +# If you dont like the uid that CAS returns (ie. it returns a number) you can +# modify the routine below to return a customized real name instead. +# +# Default: Returns the username, untouched +function casRealNameLookup($username) { + return $username; +} + # If your users aren't all on the same email domain you can # modify the routine below to return their email address #