(bug 31283) Made ChangeEmail check $wgAuth->allowPropChange( 'emailaddress' ). Fix...
authorAaron Schulz <aaron@users.mediawiki.org>
Fri, 30 Sep 2011 20:43:45 +0000 (20:43 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Fri, 30 Sep 2011 20:43:45 +0000 (20:43 +0000)
includes/Preferences.php
includes/specials/SpecialChangeEmail.php
languages/messages/MessagesEn.php

index 69fd1b7..0fc908a 100644 (file)
@@ -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)
index 71e7cbd..45cff6a 100644 (file)
@@ -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;
index b231c4a..b26f889 100644 (file)
@@ -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}}',