From 80fbb705e56efeeca719169faef890509e7a14d5 Mon Sep 17 00:00:00 2001 From: Ryan Lane Date: Thu, 21 Jun 2012 14:59:01 +0200 Subject: [PATCH] Simplifying domain getting/setting Adding a function to AuthPlugin for getting the user's domain. This allows the extension to determine how the user's domain is get and set, rather than core. Change-Id: Ib2414bd55dfde67f7caf6439680fa88d9266e991 --- RELEASE-NOTES-1.20 | 1 + includes/AuthPlugin.php | 13 +++++++++++++ includes/specials/SpecialChangePassword.php | 5 +---- includes/specials/SpecialUserlogin.php | 6 +----- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/RELEASE-NOTES-1.20 b/RELEASE-NOTES-1.20 index addf48425c..21d63d9ac9 100644 --- a/RELEASE-NOTES-1.20 +++ b/RELEASE-NOTES-1.20 @@ -71,6 +71,7 @@ upgrade PHP if you have not done so prior to upgrading MediaWiki. * cleanupSpam.php now can delete spam pages if --delete was specified instead of blanking them. * Added new hook ChangePasswordForm to allow adding of additional fields in Special:ChangePassword +* Added new function getDomain to AuthPlugin for getting a user's domain === Bug fixes in 1.20 === * (bug 30245) Use the correct way to construct a log page title. diff --git a/includes/AuthPlugin.php b/includes/AuthPlugin.php index e550473713..9cdd4f345d 100644 --- a/includes/AuthPlugin.php +++ b/includes/AuthPlugin.php @@ -83,6 +83,19 @@ class AuthPlugin { $this->domain = $domain; } + /** + * Get the user's domain + * + * @return string + */ + public function getDomain() { + if ( $this->domain ) { + return $this->domain; + } else { + return 'invaliddomain'; + } + } + /** * Check to see if the specific domain is a valid domain. * diff --git a/includes/specials/SpecialChangePassword.php b/includes/specials/SpecialChangePassword.php index 2b88325803..b30605b7e1 100644 --- a/includes/specials/SpecialChangePassword.php +++ b/includes/specials/SpecialChangePassword.php @@ -63,10 +63,7 @@ class SpecialChangePassword extends UnlistedSpecialPage { if( $request->wasPosted() && $user->matchEditToken( $request->getVal( 'token' ) ) ) { try { - if ( isset( $_SESSION['wsDomain'] ) ) { - $this->mDomain = $_SESSION['wsDomain']; - } - $wgAuth->setDomain( $this->mDomain ); + $this->mDomain = $wgAuth->getDomain(); if( !$wgAuth->allowPasswordChange() ) { $this->error( $this->msg( 'resetpass_forbidden' )->text() ); return; diff --git a/includes/specials/SpecialUserlogin.php b/includes/specials/SpecialUserlogin.php index ded2721223..7d91096f2c 100644 --- a/includes/specials/SpecialUserlogin.php +++ b/includes/specials/SpecialUserlogin.php @@ -125,11 +125,7 @@ class LoginForm extends SpecialPage { } if( !$wgAuth->validDomain( $this->mDomain ) ) { - if ( isset( $_SESSION['wsDomain'] ) ) { - $this->mDomain = $_SESSION['wsDomain']; - } else { - $this->mDomain = 'invaliddomain'; - } + $this->mDomain = $wgAuth->getDomain(); } $wgAuth->setDomain( $this->mDomain ); -- 2.20.1