Brion VIBBER has submitted this change and it was merged.

Change subject: SpecialUserlogin: Error out when attempting to create a 
username with a '#'
......................................................................


SpecialUserlogin: Error out when attempting to create a username with a '#'

"Best practices"? Ain't never heard of it.

Bug: 64960
Change-Id: I88c479cea2bc9d2eab882e0ee8ebcbe2d1dd125e
---
M includes/specials/SpecialUserlogin.php
1 file changed, 5 insertions(+), 1 deletion(-)

Approvals:
  Brion VIBBER: Looks good to me, approved



diff --git a/includes/specials/SpecialUserlogin.php 
b/includes/specials/SpecialUserlogin.php
index 4006e49..5ce2812 100644
--- a/includes/specials/SpecialUserlogin.php
+++ b/includes/specials/SpecialUserlogin.php
@@ -435,7 +435,11 @@
 
                // 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.
+               // 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' );

-- 
To view, visit https://gerrit.wikimedia.org/r/132584
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I88c479cea2bc9d2eab882e0ee8ebcbe2d1dd125e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Bartosz DziewoƄski <matma....@gmail.com>
Gerrit-Reviewer: Brion VIBBER <br...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to