summaryrefslogtreecommitdiff
path: root/plugins/Authentication
diff options
context:
space:
mode:
authorCraig Andrews <candrews@integralblue.com>2009-11-13 12:54:27 -0500
committerCraig Andrews <candrews@integralblue.com>2009-11-13 12:54:27 -0500
commitb9562cbb18a7b8f3f01bcbc8540933c4dfc10fb9 (patch)
tree66e60ea24631b24de75ecd80e5d3f95d8e13f8d0 /plugins/Authentication
parent21603f02258346aa516db77c1691ee32f180fcbc (diff)
autoregister returns the new user on success (not just true)
Diffstat (limited to 'plugins/Authentication')
-rw-r--r--plugins/Authentication/AuthenticationPlugin.php23
1 files changed, 13 insertions, 10 deletions
diff --git a/plugins/Authentication/AuthenticationPlugin.php b/plugins/Authentication/AuthenticationPlugin.php
index 99b61b808..f061e456d 100644
--- a/plugins/Authentication/AuthenticationPlugin.php
+++ b/plugins/Authentication/AuthenticationPlugin.php
@@ -70,7 +70,7 @@ 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
- * @return boolean true if the user was created, false if not
+ * @return mixed instance of User, or false (if user couldn't be created)
*/
function autoRegister($username)
{
@@ -134,15 +134,18 @@ abstract class AuthenticationPlugin extends Plugin
}else{
if($this->autoregistration){
$authenticated = $this->checkPassword($nickname, $password);
- if($authenticated && $this->autoregister($nickname)){
- $authenticatedUser = User::staticGet('nickname', $nickname);
- $user_username = new User_username();
- $user_username->user_id = $authenticatedUser->id;
- $user_username->provider_name = $this->provider_name;
- $user_username->username = $nickname;
- $user_username->created = DB_DataObject_Cast::dateTime();
- $user_username->insert();
- return false;
+ if($authenticated){
+ $user = $this->autoregister($nickname);
+ if($user){
+ $authenticatedUser = $user;
+ $user_username = new User_username();
+ $user_username->user_id = $authenticatedUser->id;
+ $user_username->provider_name = $this->provider_name;
+ $user_username->username = $nickname;
+ $user_username->created = DB_DataObject_Cast::dateTime();
+ $user_username->insert();
+ return false;
+ }
}
}
}