From c1299db100c12b776f685b341866f9a5e985c99a Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Mon, 18 Feb 2013 08:13:38 +0100 Subject: [PATCH] (bug 45012) Do not show a "badretype" error when creating an account by e-mail. Change-Id: Idd1ffaef60dc2ab2498a3dabe2902051aea990d2 --- RELEASE-NOTES-1.21 | 2 ++ includes/specials/SpecialUserlogin.php | 22 ++++++++++++---------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/RELEASE-NOTES-1.21 b/RELEASE-NOTES-1.21 index 2eca857f86..34030beabc 100644 --- a/RELEASE-NOTES-1.21 +++ b/RELEASE-NOTES-1.21 @@ -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. diff --git a/includes/specials/SpecialUserlogin.php b/includes/specials/SpecialUserlogin.php index 78383bd77e..27701d4cff 100644 --- a/includes/specials/SpecialUserlogin.php +++ b/includes/specials/SpecialUserlogin.php @@ -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; } } -- 2.20.1