From 78c7f02c8ce3ceb6f2a0a2c9fa5cac6a04b00e37 Mon Sep 17 00:00:00 2001 From: Aryeh Gregor Date: Sun, 13 Dec 2009 20:24:38 +0000 Subject: [PATCH] Automatically link on login if passwords match --- includes/specials/SpecialUserlogin.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/includes/specials/SpecialUserlogin.php b/includes/specials/SpecialUserlogin.php index d16c6c6522..554e5f8321 100644 --- a/includes/specials/SpecialUserlogin.php +++ b/includes/specials/SpecialUserlogin.php @@ -394,10 +394,8 @@ class LoginForm { * This may create a local account as a side effect if the * authentication plugin allows transparent local account * creation. - * - * @public */ - function authenticateUserData() { + public function authenticateUserData() { global $wgUser, $wgAuth; if ( '' == $this->mName ) { return self::NO_NAME; @@ -451,6 +449,15 @@ class LoginForm { $isAutoCreated = true; } } else { + global $wgExternalAuthType, $wgAutocreatePolicy; + if ( $wgExternalAuthType && $wgAutocreatePolicy != 'never' + && is_object( $this->mExtUser ) + && $this->mExtUser->authenticate( $this->mPassword ) ) { + # The external user and local user have the same name and + # password, so we assume they're the same. + $this->mExtUser->linkToLocal( $u->getID() ); + } + $u->load(); } -- 2.20.1