From 77a1935aa88c63203bd87cafd9734df454e5a05a Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Sat, 4 Aug 2007 16:34:21 +0000 Subject: [PATCH] Clean up autocreation a smidge... let the auth plugin know whether the user you're setting up was created manually or by the autocreation path, and have the CentralAuth plugin know whether it should be attaching (for autocreate) or not (for non-autocreate) --- includes/SpecialUserlogin.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/includes/SpecialUserlogin.php b/includes/SpecialUserlogin.php index 0e26ba9366..2689c03c4c 100644 --- a/includes/SpecialUserlogin.php +++ b/includes/SpecialUserlogin.php @@ -296,7 +296,7 @@ class LoginForm { return false; } - return $this->initUser( $u ); + return $this->initUser( $u, false ); } /** @@ -304,10 +304,11 @@ class LoginForm { * Give it a User object that has been initialised with a name. * * @param $u User object. + * @param $autocreate boolean -- true if this is an autocreation via auth plugin * @return User object. * @private */ - function initUser( $u ) { + function initUser( $u, $autocreate ) { global $wgAuth; $u->addToDatabase(); @@ -320,7 +321,7 @@ class LoginForm { $u->setRealName( $this->mRealName ); $u->setToken(); - $wgAuth->initUser( $u ); + $wgAuth->initUser( $u, $autocreate ); $u->setOption( 'rememberpassword', $this->mRemember ? 1 : 0 ); $u->saveSettings(); @@ -359,7 +360,7 @@ class LoginForm { */ if ( $wgAuth->autoCreate() && $wgAuth->userExists( $u->getName() ) ) { if ( $wgAuth->authenticate( $u->getName(), $this->mPassword ) ) { - $u = $this->initUser( $u ); + $u = $this->initUser( $u, true ); } else { return self::WRONG_PLUGIN_PASS; } -- 2.20.1