diff options
author | Sarven Capadisli <csarven@status.net> | 2010-01-05 01:16:48 +0000 |
---|---|---|
committer | Sarven Capadisli <csarven@status.net> | 2010-01-05 01:16:48 +0000 |
commit | 48289e607bf207b40201075be8b599c0f3fa597e (patch) | |
tree | d310e7091467460905287bc29b33098cf986a906 /plugins/Authentication/AuthenticationPlugin.php | |
parent | eb9514120a882aacae38f8b85a1f431852b44b89 (diff) | |
parent | 440b9957f9ae6fdfdb44c39074803fcdbc64112d (diff) |
Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x
Diffstat (limited to 'plugins/Authentication/AuthenticationPlugin.php')
-rw-r--r-- | plugins/Authentication/AuthenticationPlugin.php | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/plugins/Authentication/AuthenticationPlugin.php b/plugins/Authentication/AuthenticationPlugin.php index a76848b04..75e8d2b76 100644 --- a/plugins/Authentication/AuthenticationPlugin.php +++ b/plugins/Authentication/AuthenticationPlugin.php @@ -99,6 +99,23 @@ abstract class AuthenticationPlugin extends Plugin } } + /** + * Internal AutoRegister event handler + * @param nickname + * @param provider_name + * @param user - the newly registered user + */ + function onAutoRegister($nickname, $provider_name, &$user) + { + if($provider_name == $this->provider_name && $this->autoregistration){ + $user = $this->autoregister($nickname); + if($user){ + User_username::register($user,$nickname,$this->provider_name); + return false; + } + } + } + function onStartCheckPassword($nickname, $password, &$authenticatedUser){ //map the nickname to a username $user_username = new User_username(); @@ -127,13 +144,10 @@ abstract class AuthenticationPlugin extends Plugin } } }else{ - if($this->autoregistration){ - $authenticated = $this->checkPassword($nickname, $password); - if($authenticated){ - $user = $this->autoregister($nickname); - if($user){ - $authenticatedUser = $user; - User_username::register($authenticatedUser,$nickname,$this->provider_name); + $authenticated = $this->checkPassword($nickname, $password); + if($authenticated){ + if(Event::handle('AutoRegister', array($nickname, $this->provider_name, &$authenticatedUser))){ + if($authenticatedUser){ return false; } } |