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
This commit is contained in:
Ryan Lane 2012-06-21 14:59:01 +02:00
parent 70594aae02
commit 80fbb705e5
4 changed files with 16 additions and 9 deletions

View file

@ -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.

View file

@ -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.
*

View file

@ -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;

View file

@ -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 );