Page MenuHomePhabricator

allow lower-case user names
Open, LowPublic

Description

Brion did work long ago {T4290: Disallow usernames that are too similar to existing names (confusables, impersonation)} to make sure usernames with different capitalisation wouldn't conflict. I've created users with an initial lower case letter and found that they work.

These users show up on an un-modified MediaWiki's RecentChanges page. You can search for the uploads on ListFiles. However some pages do not show these users.

For example, even though the user "lowercaseUser" had been created, going to [[User:lowercaseUser]], [[Special:UserRights/lowercaseUser]] and [[Special:Contributions/lowecaseUser]] would say the user doesn't exist.

Upon examination, all these cases relied on the value of the private MWNamespace::$ $alwaysCapitalizedNamespaces. Removing NS_USER from that list allowed the special pages to understand that the user existed and act accordingly. (Note, I also removed a couple of ucfirst() calls in User.php.)

Since T4290 ensures that users won't be able to create a user named "LowercaseUser", and "lowercaseUser" is only allowed normally if $wgCapitalLinks is false (not the default), I think this is a safe change.

Event Timeline

Note that I have found that the following code from 2005 in User::isValidUserName() causes problems here since it assumes all namespaces are treated the same. That is, setting

$wgCapitalLinks = false

works, but

$wgCapitalLinkOverrides[NS_USER] = false;

does not. However,

$wgCapitalLinkOverrides[NS_USER] = false;
$wgCapitalLinkOverrides[NS_MAIN] = false;

works since NS_MAIN can have lower case titles and the comparision in the following code treats a name as though it was in the main namespace.

		// Ensure that the name can't be misresolved as a different title,
		// such as with extra namespace keys at the start.
		$parsed = Title::newFromText( $name );
		if ( is_null( $parsed )
			|| $parsed->getNamespace()
			|| strcmp( $name, $parsed->getPrefixedText() ) ) {
			return false;
		}

Change 295101 had a related patch set uploaded (by MarkAHershberger):
Allow usernames with an initial lowercase letter.

https://gerrit.wikimedia.org/r/295101

Might be a idea to setup a test instance on labs to make sure extensions work as desired with the changes.

A lot of extensions are going to require updates... (I trimmed what looked like irrelevant matches from the below grep)

km@km-tp ~/p/v/m/extensions> ack \\\-\\\>ucfirst --php
EditAccount/SpecialCloseAccount.body.php
101:		$userName = $this->getLanguage()->ucfirst( $userName );

EditAccount/SpecialEditAccount_body.php
95:			$userName = $this->getLanguage()->ucfirst( $userName );

CentralAuth/includes/specials/SpecialMultiLock.php
54:			$this->mPrefixSearch = $this->getLanguage()->ucfirst( trim( $this->mPrefixSearch ) );
94:			$username = $this->getLanguage()->ucfirst( $username );

CentralAuth/includes/specials/SpecialCentralAuth.php
51:		$this->mUserName = $wgContLang->ucfirst( $this->mUserName );

CentralAuth/includes/specials/SpecialGlobalUsers.php
31:		$rqUsername = $wgContLang->ucfirst( $req->getVal( 'username' ) );

CentralAuth/includes/specials/SpecialWikiSets.php
290:		$name = $wgContLang->ucfirst( $this->getRequest()->getVal( 'wpName' ) );

UserMerge/MergeUser.php
373:		$newusername = Title::makeTitleSafe( NS_USER, $wgContLang->ucfirst( $this->newUser->getName() ) );

ReassignEdits/ReassignEdits_body.php
59:		$newusername = Title::makeTitleSafe( NS_USER, $wgContLang->ucfirst( $request->getText( 'newusername' ) ) );

Renameuser/specials/SpecialRenameuser.php
56:		$newusername = Title::makeTitleSafe( NS_USER, $wgContLang->ucfirst( $newnamePar ) );
256:		if ( $oldusername->getText() !== $wgContLang->ucfirst( $oldusername->getText() ) ) {

MobileFrontend/includes/specials/SpecialMobileDiff.php
363:				$memberName = $this->getLanguage()->ucfirst( $memberName );

SocialLogin/SocialLogin.body.php
63:		$name = $wgContLang->ucfirst($name);
158:				$name = $wgContLang->ucfirst($wgRequest->getText('name'));
177:				$name = $wgContLang->ucfirst($wgRequest->getText('name'));
242:				$name = $wgContLang->ucfirst($wgRequest->getText('name'));
291:				$name = $wgContLang->ucfirst($wgRequest->getText('name'));

There's also probably a lot of third-party code making this assumption, e.g. scripts and API clients.

Change 295101 abandoned by MarkAHershberger:
Allow usernames with an initial lowercase letter.

https://gerrit.wikimedia.org/r/295101