From cce8fa0875f68011d950e929240df71861476f31 Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Tue, 1 May 2007 17:52:13 +0000 Subject: [PATCH] Fix backtrace when creating an account with a password being the same as the username (r21640, bug 3348). --- includes/SpecialUserlogin.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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; } -- 2.20.1