summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCraig Andrews <candrews@integralblue.com>2010-03-01 11:48:46 -0500
committerCraig Andrews <candrews@integralblue.com>2010-03-01 11:56:07 -0500
commit3bfe3345df1c2faf0288f1b18d205d793e740aae (patch)
treeb81c92ee16671cfd81576b92f947a16f97cdc0f3
parent7410571bda4bc584408f6c575b1dbe9f50822e3d (diff)
Use common_nicknamize() in better places.
-rw-r--r--lib/authenticationplugin.php8
-rw-r--r--plugins/LdapAuthentication/LdapAuthenticationPlugin.php9
2 files changed, 9 insertions, 8 deletions
diff --git a/lib/authenticationplugin.php b/lib/authenticationplugin.php
index 97e9d52de..0a3763e2e 100644
--- a/lib/authenticationplugin.php
+++ b/lib/authenticationplugin.php
@@ -79,7 +79,7 @@ abstract class AuthenticationPlugin extends Plugin
$nickname = $username;
}
$registration_data = array();
- $registration_data['nickname'] = common_nicknamize($nickname);
+ $registration_data['nickname'] = $nickname;
return User::register($registration_data);
}
@@ -101,12 +101,14 @@ abstract class AuthenticationPlugin extends Plugin
* Used during autoregistration
* Useful if your usernames are ugly, and you want to suggest
* nice looking nicknames when users initially sign on
+ * All nicknames returned by this function should be valid
+ * implementations may want to use common_nicknamize() to ensure validity
* @param username
* @return string nickname
*/
function suggestNicknameForUsername($username)
{
- return $username;
+ return common_nicknamize($username);
}
//------------Below are the methods that connect StatusNet to the implementing Auth plugin------------\\
@@ -129,7 +131,7 @@ abstract class AuthenticationPlugin extends Plugin
$test_user = User::staticGet('nickname', $suggested_nickname);
if($test_user) {
//someone already exists with the suggested nickname, so used the passed nickname
- $suggested_nickname = $nickname;
+ $suggested_nickname = common_nicknamize($nickname);
}
$test_user = User::staticGet('nickname', $suggested_nickname);
if($test_user) {
diff --git a/plugins/LdapAuthentication/LdapAuthenticationPlugin.php b/plugins/LdapAuthentication/LdapAuthenticationPlugin.php
index d6a945f49..e0fd615dd 100644
--- a/plugins/LdapAuthentication/LdapAuthenticationPlugin.php
+++ b/plugins/LdapAuthentication/LdapAuthenticationPlugin.php
@@ -189,15 +189,14 @@ class LdapAuthenticationPlugin extends AuthenticationPlugin
$entry = $this->ldap_get_user($username, $this->attributes);
if(!$entry){
//this really shouldn't happen
- return $username;
+ $nickname = $username;
}else{
$nickname = $entry->getValue($this->attributes['nickname'],'single');
- if($nickname){
- return $nickname;
- }else{
- return $username;
+ if(!$nickname){
+ $nickname = $username;
}
}
+ return common_nicknamize($nickname);
}
//---utility functions---//