(bug 45012) Do not show a "badretype" error when creating an account by e-mail.
authorAlexandre Emsenhuber <ialex.wiki@gmail.com>
Mon, 18 Feb 2013 07:13:38 +0000 (08:13 +0100)
committerParent5446 <tylerromeo@gmail.com>
Wed, 20 Feb 2013 16:03:37 +0000 (16:03 +0000)
Change-Id: Idd1ffaef60dc2ab2498a3dabe2902051aea990d2

RELEASE-NOTES-1.21
includes/specials/SpecialUserlogin.php

index 2eca857..34030be 100644 (file)
@@ -171,6 +171,8 @@ production.
 * (bug 44775) The username field is not pre-filled when creating an account.
 * (bug 45069) wfParseUrl() no longer produces a PHP notice if passed a "mailto:"
   URL without address
+* (bug 45012) Creating an account by e-mail can no longer show a
+  "password mismatch" error.
 
 === API changes in 1.21 ===
 * prop=revisions can now report the contentmodel and contentformat.
index 78383bd..27701d4 100644 (file)
@@ -373,22 +373,24 @@ class LoginForm extends SpecialPage {
                        return Status::newFatal( 'noname' );
                } elseif ( 0 != $u->idForName() ) {
                        return Status::newFatal( 'userexists' );
-               } elseif ( 0 != strcmp( $this->mPassword, $this->mRetype ) ) {
-                       return Status::newFatal( 'badretype' );
                }
 
-               # check for minimal password length
-               $valid = $u->getPasswordValidity( $this->mPassword );
-               if ( $valid !== true ) {
-                       if ( !$this->mCreateaccountMail ) {
+               if ( $this->mCreateaccountMail ) {
+                       # do not force a password for account creation by email
+                       # set invalid password, it will be replaced later by a random generated password
+                       $this->mPassword = null;
+               } else {
+                       if ( $this->mPassword !== $this->mRetype ) {
+                               return Status::newFatal( 'badretype' );
+                       }
+
+                       # check for minimal password length
+                       $valid = $u->getPasswordValidity( $this->mPassword );
+                       if ( $valid !== true ) {
                                if ( !is_array( $valid ) ) {
                                        $valid = array( $valid, $wgMinimalPasswordLength );
                                }
                                return call_user_func_array( 'Status::newFatal', $valid );
-                       } else {
-                               # do not force a password for account creation by email
-                               # set invalid password, it will be replaced later by a random generated password
-                               $this->mPassword = null;
                        }
                }