Fix backtrace when creating an account with a password being the same as the
authorAntoine Musso <hashar@users.mediawiki.org>
Tue, 1 May 2007 17:52:13 +0000 (17:52 +0000)
committerAntoine Musso <hashar@users.mediawiki.org>
Tue, 1 May 2007 17:52:13 +0000 (17:52 +0000)
username (r21640, bug 3348).

includes/SpecialUserlogin.php

index ff3abc5..2de164b 100644 (file)
@@ -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;
                }