From: Antoine Musso Date: Tue, 1 May 2007 17:52:13 +0000 (+0000) Subject: Fix backtrace when creating an account with a password being the same as the X-Git-Tag: 1.31.0-rc.0~53149 X-Git-Url: http://git.cyclocoop.org/%24href?a=commitdiff_plain;h=cce8fa0875f68011d950e929240df71861476f31;p=lhc%2Fweb%2Fwiklou.git Fix backtrace when creating an account with a password being the same as the username (r21640, bug 3348). --- diff --git a/includes/SpecialUserlogin.php b/includes/SpecialUserlogin.php index ff3abc5767..2de164b7dc 100644 --- a/includes/SpecialUserlogin.php +++ b/includes/SpecialUserlogin.php @@ -228,6 +228,7 @@ class LoginForm { return false; } + # Check anonymous user ($wgUser) limitations : if (!$wgUser->isAllowedToCreateAccount()) { $this->userNotPrivilegedMessage(); return false; @@ -241,6 +242,7 @@ class LoginForm { return; } + # Now create a dummy user ($u) and check if it is valid $name = trim( $this->mName ); $u = User::newFromName( $name, 'creatable' ); if ( is_null( $u ) ) { @@ -258,7 +260,7 @@ class LoginForm { return false; } - if ( !$wgUser->isValidPassword( $this->mPassword ) ) { + if ( !$u->isValidPassword( $this->mPassword ) ) { $this->mainLoginForm( wfMsg( 'passwordtooshort', $wgMinimalPasswordLength ) ); return false; }