summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSarven Capadisli <csarven@status.net>2010-01-31 19:25:49 +0000
committerSarven Capadisli <csarven@status.net>2010-01-31 19:25:49 +0000
commit339eb1adadc7f3495ad31ef0a5cf20cdca47ce1f (patch)
treecf3fe727c56b5f8a2c241915dc04abd22d07ac50 /lib
parentedf99dc45bcb28f60ea260e2a2a1bad148971a97 (diff)
parentbd5278302574ae3af87f09e0d8191c95ab93582a (diff)
Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x
Diffstat (limited to 'lib')
-rw-r--r--lib/authenticationplugin.php12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/authenticationplugin.php b/lib/authenticationplugin.php
index 17237086c..5be3ea5b9 100644
--- a/lib/authenticationplugin.php
+++ b/lib/authenticationplugin.php
@@ -69,13 +69,17 @@ abstract class AuthenticationPlugin extends Plugin
/**
* Automatically register a user when they attempt to login with valid credentials.
* User::register($data) is a very useful method for this implementation
- * @param username
+ * @param username username (that is used to login and find the user in the authentication provider) of the user to be registered
+ * @param nickname nickname of the user in the SN system. If nickname is null, then set nickname = username
* @return mixed instance of User, or false (if user couldn't be created)
*/
- function autoRegister($username)
+ function autoRegister($username, $nickname = null)
{
+ if(is_null($nickname)){
+ $nickname = $username;
+ }
$registration_data = array();
- $registration_data['nickname'] = $username ;
+ $registration_data['nickname'] = $nickname ;
return User::register($registration_data);
}
@@ -132,7 +136,7 @@ abstract class AuthenticationPlugin extends Plugin
//someone already exists with the suggested nickname
//not much else we can do
}else{
- $user = $this->autoregister($suggested_nickname);
+ $user = $this->autoRegister($nickname, $suggested_nickname);
if($user){
User_username::register($user,$nickname,$this->provider_name);
return false;