From d210b080fa698bc900ce38e7926c759943744a89 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Thu, 30 Nov 2006 20:55:44 +0000 Subject: [PATCH] * Fix regression in authentication hook auto-creation on login --- RELEASE-NOTES | 2 +- includes/SpecialUserlogin.php | 19 +++++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 5a72c0bd96..ea652b66f4 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -228,7 +228,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN images, not horizontally. * Patch from LeonWP: added UploadForm:BeforeProcessing hook in SpecialUpload.php * Add AuthPluginSetup hook to override $wgAuth after configuration -* (bug 1331) Add "next page" link to bottom of Special:Allpages in chunk mode +* Fix regression in authentication hook auto-creation on login == Languages updated == diff --git a/includes/SpecialUserlogin.php b/includes/SpecialUserlogin.php index 7205043164..d43d249c25 100644 --- a/includes/SpecialUserlogin.php +++ b/includes/SpecialUserlogin.php @@ -296,7 +296,7 @@ class LoginForm { * @return User object. * @private */ - function &initUser( &$u ) { + function initUser( $u ) { $u->addToDatabase(); $u->setPassword( $this->mPassword ); $u->setEmail( $this->mEmail ); @@ -307,16 +307,21 @@ class LoginForm { $wgAuth->initUser( $u ); $u->setOption( 'rememberpassword', $this->mRemember ? 1 : 0 ); + $u->saveSettings(); return $u; } /** + * Internally authenticate the login request. + * + * This may create a local account as a side effect if the + * authentication plugin allows transparent local account + * creation. + * * @public */ - - function authenticateUserData() - { + function authenticateUserData() { global $wgUser, $wgAuth; if ( '' == $this->mName ) { return self::NO_NAME; @@ -334,7 +339,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 ); } else { return self::WRONG_PLUGIN_PASS; } @@ -347,9 +352,7 @@ class LoginForm { if (!$u->checkPassword( $this->mPassword )) { return '' == $this->mPassword ? self::EMPTY_PASS : self::WRONG_PASS; - } - else - { + } else { $wgAuth->updateUser( $u ); $wgUser = $u; -- 2.20.1