From 252e9ab048f1b30e1afaaa40fbca60d3ec9f3ee0 Mon Sep 17 00:00:00 2001 From: umherirrender Date: Mon, 25 Aug 2014 20:12:27 +0200 Subject: [PATCH] Simplify checks on Special:UserLogin/signup I27c488e4008a924117ff6bac2216f148cd5e7abd changed the validation code in User::getCanonicalName, the # and Title::makeTitleSafe checks now done there and can be removed here. Follow-Up: I27c488e4008a924117ff6bac2216f148cd5e7abd Follow-Up: I88c479cea2bc9d2eab882e0ee8ebcbe2d1dd125e Follow-Up: I983e3f528491817f9f31f71a92d8d2946ce5941d Change-Id: I17bf88be6398dc402295264ca9bfd57809c872d7 --- includes/specials/SpecialUserlogin.php | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/includes/specials/SpecialUserlogin.php b/includes/specials/SpecialUserlogin.php index b6a3be2904..2eefd0ad20 100644 --- a/includes/specials/SpecialUserlogin.php +++ b/includes/specials/SpecialUserlogin.php @@ -527,20 +527,8 @@ class LoginForm extends SpecialPage { return Status::newFatal( 'sorbs_create_account_reason' ); } - // Normalize the name so that silly things don't cause "invalid username" - // errors. User::newFromName does some rather strict checking, rejecting - // e.g. leading/trailing/multiple spaces. But first we need to reject - // usernames that would be treated as titles with a fragment part. - if ( strpos( $this->mUsername, '#' ) !== false ) { - return Status::newFatal( 'noname' ); - } - $title = Title::makeTitleSafe( NS_USER, $this->mUsername ); - if ( !is_object( $title ) ) { - return Status::newFatal( 'noname' ); - } - # Now create a dummy user ($u) and check if it is valid - $u = User::newFromName( $title->getText(), 'creatable' ); + $u = User::newFromName( $this->mUsername, 'creatable' ); if ( !is_object( $u ) ) { return Status::newFatal( 'noname' ); } elseif ( 0 != $u->idForName() ) { -- 2.20.1