]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Use common_nicknamize() in better places.
authorCraig Andrews <candrews@integralblue.com>
Mon, 1 Mar 2010 16:48:46 +0000 (11:48 -0500)
committerCraig Andrews <candrews@integralblue.com>
Mon, 1 Mar 2010 16:56:07 +0000 (11:56 -0500)
lib/authenticationplugin.php
plugins/LdapAuthentication/LdapAuthenticationPlugin.php

index 97e9d52de5b71bd9db40eee163783a171dbc52af..0a3763e2e4644d895095876acf13934393559f42 100644 (file)
@@ -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) {
index d6a945f4977bca229bbbaeea56729e6248751c4c..e0fd615ddaab89f959fbc93ad83f65c93f4d03e8 100644 (file)
@@ -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---//