Merge "(bug 44775) Don't pre-fill username when creating."
authorCSteipp <csteipp@wikimedia.org>
Wed, 13 Feb 2013 18:28:47 +0000 (18:28 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 13 Feb 2013 18:28:47 +0000 (18:28 +0000)
1  2 
RELEASE-NOTES-1.21
includes/specials/SpecialUserlogin.php

diff --combined RELEASE-NOTES-1.21
@@@ -165,6 -165,7 +165,7 @@@ production
    ca-edit click instead opening URL directly.
  * (bug 43964) Invalid value of "link" parameter in <gallery> no longer produces
    a fatal error.
+ * (bug 44775) The username field is not pre-filled when creating an account.
  
  === API changes in 1.21 ===
  * prop=revisions can now report the contentmodel and contentformat.
    that the imagerepository property will no longer be set on page objects not
    processed in the current query (i.e. non-images or those skipped due to
    iicontinue).
 +* Add supports for all pageset capabilities - generators, redirects, converttitles to
 +  action=purge and action=setnotificationtimestamp.
  
  === API internal changes in 1.21 ===
  * For debugging only, a new global $wgDebugAPI removes many API restrictions when true.
    Whenever enabled, a warning will also be added to all output.
  * ApiModuleManager now handles all submodules (actions,props,lists) and instantiation
  * Query stores prop/list/meta as submodules
 +* ApiPageSet can now be used in any action to process titles/pageids/revids or any generator.
 +* BREAKING CHANGE: ApiPageSet constructor now has two params instead of three, with only the
 +  first one keeping its meaning. ApiPageSet is now derived from ApiBase.
 +* BREAKING CHANGE: ApiQuery::newGenerator() and executeGeneratorModule() were deleted.
 +* ApiQueryGeneratorBase::setGeneratorMode() now requires a pageset param.
  
  === Languages updated in 1.21 ===
  
@@@ -314,10 -314,8 +314,10 @@@ class LoginForm extends SpecialPage 
                if( 'local' != $this->mDomain && $this->mDomain != '' ) {
                        if(
                                !$wgAuth->canCreateAccounts() &&
 -                              ( !$wgAuth->userExists( $this->mUsername ||
 -                                !$wgAuth->authenticate( $this->mUsername, $this->mPassword ) ) )
 +                              (
 +                                      !$wgAuth->userExists( $this->mUsername ) ||
 +                                      !$wgAuth->authenticate( $this->mUsername, $this->mPassword )
 +                              )
                        ) {
                                return Status::newFatal( 'wrongpassword' );
                        }
  
                # if you need a confirmed email address to edit, then obviously you
                # need an email address.
 -              if ( $wgEmailConfirmToEdit && empty( $this->mEmail ) ) {
 +              if ( $wgEmailConfirmToEdit && strval( $this->mEmail ) === '' ) {
                        return Status::newFatal( 'noemailtitle' );
                }
  
 -              if( !empty( $this->mEmail ) && !Sanitizer::validateEmail( $this->mEmail ) ) {
 +              if ( strval( $this->mEmail ) !== '' && !Sanitizer::validateEmail( $this->mEmail ) ) {
                        return Status::newFatal( 'invalidemailaddress' );
                }
  
                        }
                }
  
-               if ( $this->mUsername == '' ) {
+               // Pre-fill username (if not creating an account, bug 44775).
+               if ( $this->mUsername == '' && $this->mType != 'signup' ) {
                        if ( $user->isLoggedIn() ) {
                                $this->mUsername = $user->getName();
                        } else {