From: Aaron Schulz Date: Fri, 30 Sep 2011 20:43:45 +0000 (+0000) Subject: (bug 31283) Made ChangeEmail check $wgAuth->allowPropChange( 'emailaddress' ). Fix... X-Git-Tag: 1.31.0-rc.0~27341 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=97a9a6899f41f933fd54435c0f5028e11491285b;p=lhc%2Fweb%2Fwiklou.git (bug 31283) Made ChangeEmail check $wgAuth->allowPropChange( 'emailaddress' ). Fix for r92924. Mark beat me to committing the rest of the fix in r98558, which just hid the link to the special page. --- diff --git a/includes/Preferences.php b/includes/Preferences.php index 69fd1b7d36..0fc908a1b3 100644 --- a/includes/Preferences.php +++ b/includes/Preferences.php @@ -1424,6 +1424,7 @@ class Preferences { /* * Try to set a user's email address. * This does *not* try to validate the address. + * Caller is responsible for checking $wgAuth. * @param $user User * @param $newaddr string New email address * @return Array (true on success or Status on failure, info string) diff --git a/includes/specials/SpecialChangeEmail.php b/includes/specials/SpecialChangeEmail.php index 71e7cbdb04..45cff6aad4 100644 --- a/includes/specials/SpecialChangeEmail.php +++ b/includes/specials/SpecialChangeEmail.php @@ -31,10 +31,16 @@ class SpecialChangeEmail extends UnlistedSpecialPage { parent::__construct( 'ChangeEmail' ); } + function isListed() { + global $wgAuth; + return $wgAuth->allowPropChange( 'emailaddress' ); + } + /** * Main execution point */ function execute( $par ) { + global $wgAuth; if ( wfReadOnly() ) { throw new ReadOnlyError; } @@ -51,6 +57,11 @@ class SpecialChangeEmail extends UnlistedSpecialPage { $user = $this->getUser(); + if ( !$wgAuth->allowPropChange( 'emailaddress' ) ) { + $this->error( wfMsgExt( 'cannotchangeemail', 'parseinline' ) ); + return; + } + if ( !$request->wasPosted() && !$user->isLoggedIn() ) { $this->error( wfMsg( 'changeemail-no-info' ) ); return; diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index b231c4a7a2..b26f889b07 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -1126,6 +1126,7 @@ No e-mail will be sent for any of the following features.', 'emailconfirmlink' => 'Confirm your e-mail address', 'invalidemailaddress' => 'The e-mail address cannot be accepted as it appears to have an invalid format. Please enter a well-formatted address or empty that field.', +'cannotchangeemail' => 'Account e-mail addresses cannot be changed on this wiki.', 'accountcreated' => 'Account created', 'accountcreatedtext' => 'The user account for $1 has been created.', 'createaccount-title' => 'Account creation for {{SITENAME}}',