Last modified: 2008-10-20 00:28:46 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T14232, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 12232 - AntiSpoof should return more than one result
AntiSpoof should return more than one result
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
AntiSpoof (Other open bugs)
unspecified
All All
: Normal enhancement with 10 votes (vote)
: ---
Assigned To: Nobody - You can work on this!
http://www.mediawiki.org/wiki/Extensi...
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-12-07 13:45 UTC by SQL
Modified: 2008-10-20 00:28 UTC (History)
10 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
First patch - Displays up to 5 matching usernames. (2.85 KB, patch)
2008-06-24 09:48 UTC, SQL
Details
Patch against HEAD - Also puts a nice "and more" message if there are more than five. (3.34 KB, patch)
2008-06-27 14:09 UTC, Tyler Romeo
Details
Correct patch against HEAD (2.59 KB, patch)
2008-06-27 17:42 UTC, OverlordQ
Details
Patch against HEAD - Minor cleanup (2.56 KB, patch)
2008-06-27 18:18 UTC, SQL
Details
Patch that should address brions concerns (2.67 KB, patch)
2008-07-23 05:33 UTC, OverlordQ
Details
Yet another Patch (3.37 KB, patch)
2008-07-24 01:10 UTC, OverlordQ
Details
Yet another Patch (2.92 KB, patch)
2008-07-30 23:13 UTC, OverlordQ
Details
Last one? (3.56 KB, patch)
2008-08-19 00:35 UTC, OverlordQ
Details

Description SQL 2007-12-07 13:45:19 UTC
Per the reasons here: 

http://en.wikipedia.org/wiki/WT:ACC#We_may_have_a_.28minor.29_problem

I really think, it would be helpful, if AntiSpoof could be configured to return multiple results, (say, maybe 3-5?) when user registration is denied due to a similar username.

(It said I had to select a component, or, just guess, so, since AntiSpoof isn't listed here, I just picked something at random near the top -- I hope this isn't a problem)
Comment 1 Brion Vibber 2007-12-07 15:47:00 UTC
(Added component to file bug correctly.)
Comment 2 SQL 2007-12-20 04:54:10 UTC
Perhaps, as well, it should return any and all Admin/Crat accounts, that match, and, mark them as such.
Comment 3 X! 2008-03-02 01:57:01 UTC
Second this request. Very good idea.
Comment 4 Simon Walker 2008-03-19 09:42:51 UTC
This can also return a match which has no contribs, but another close match may be an active account. This in my opinion is important, as it will eliminate this risk.
Comment 5 SQL 2008-06-24 09:48:33 UTC
Created attachment 5015 [details]
First patch - Displays up to 5 matching usernames.

Added a rough patch to accomplish this. I wasn't quite sure how multiple names should be displayed, in the mediawiki: message, however, so that bit is a little clumsy yet. Tested it against HEAD.
Comment 6 SQL 2008-06-27 03:27:44 UTC
Comment on attachment 5015 [details]
First patch - Displays up to 5 matching usernames.

Patch was against REL1.12, not head, would not work.
Comment 7 Tyler Romeo 2008-06-27 14:09:25 UTC
Created attachment 5024 [details]
Patch against HEAD - Also puts a nice "and more" message if there are more than five.

This is essentially the same as the last patch, except it is against HEAD and it has a useful "and more" message at the end of the warning if there are more conflicts than the script is made to handle.
Comment 8 Tyler Romeo 2008-06-27 14:11:06 UTC
Comment on attachment 5024 [details]
Patch against HEAD - Also puts a nice "and more" message if there are more than five.

>Index: extensions/AntiSpoof/AntiSpoof.i18n.php
>===================================================================
>--- extensions/AntiSpoof/AntiSpoof.i18n.php	(revision 36517)
>+++ extensions/AntiSpoof/AntiSpoof.i18n.php	(working copy)
>@@ -1,4 +1,4 @@
>-<?php
>+<?php
> /**
>  * Internationalisation file for extension AntiSpoof.
>  *
>@@ -9,7 +9,7 @@
> 
> $messages['en'] = array(
> 	'antispoof-desc'          => 'Blocks the creation of accounts with mixed-script, confusing and similar usernames',
>-	'antispoof-name-conflict' => 'The name "$1" is too similar to the existing account "$2".
>+	'antispoof-name-conflict' => ''The name "$1" is too similar to existing accounts: $2 $3 $4 $5 $6 $7.
> Please choose another name.',
> 	'antispoof-name-illegal'  => 'The name "$1" is not allowed to prevent confusing or spoofed usernames: $2.
> Please choose another name.',
>Index: extensions/AntiSpoof/SpoofUser.php
>===================================================================
>--- extensions/AntiSpoof/SpoofUser.php	(revision 36517)
>+++ extensions/AntiSpoof/SpoofUser.php	(working copy)
>@@ -47,17 +47,26 @@
> 
> 			// Join against the user table to ensure that we skip stray
> 			// entries left after an account is renamed or otherwise munged.
>-			$row = $dbr->selectRow(
>-				array( 'spoofuser', 'user' ),
>-				array( 'user_name' ),
>-				array(
>+			$spoofedUsers = $dbr->selectRow(
>+				        array( 'spoofuser', 'user' ),
>+				        array( 'user_name' ),
>+				        array(
> 					'su_normalized' => $this->mNormalized,
> 					'su_name=user_name',
>-				),
>-				__METHOD__ );
>+				        ),
>+				        __METHOD__,
>+					array( 'LIMIT' => 6 ) );
> 
>-			if( $row ) {
>-				return $row->user_name;
>+			$spoofs = array();
>+			while( $row = $dbr->fetchObject( $spoofedUsers ) {
>+				$spoofs[] = $row->user_name;
>+			}
>+			if( count( $spoofs ) > 0 && < 6 ) {
>+				$spoofs[] = false;
>+				return $spoofs;
>+			} elseif( count( $spoofs > 6 ) {
>+				$spoofs[6] = true;
>+				return $spoofs;
> 			} else {
> 				return false;
> 			}
>Index: extensions/AntiSpoof/AntiSpoof.php
>===================================================================
>--- extensions/AntiSpoof/AntiSpoof.php	(revision 36517)
>+++ extensions/AntiSpoof/AntiSpoof.php	(working copy)
>@@ -83,10 +83,23 @@
> 		if( $conflict === false ) {
> 			wfDebugLog( 'antispoof', "{$mode}PASS new account '$name' [$normalized]" );
> 		} else {
>-			wfDebugLog( 'antispoof', "{$mode}CONFLICT new account '$name' [$normalized] spoofs '$conflict'" );
>-			if( $active ) {
>-				$message = wfMsg( 'antispoof-name-conflict', $name, $conflict );
>-				return false;
>+			$spoofNumber = count( $conflict ) - 1;
>+			$DebugLog = "{$mode}CONFLICT new account '$name' [$normalized] spoofs";
>+			for( $i = 0; $i < $spoofNumber; $i++ ) {
>+				$DebugLog .= " $conflict[$i];";
>+			}
>+			if( !$conflict[ $spoofNumber ] ) {
>+				wfDebugLog( 'antispoof', $DebugLog );
>+				if( $active ) {
>+					$message = wfMsg( 'antispoof-name-conflict', $name, $conflict[0], $conflict[1], $conflict[2], $conflict[3], $conflict[4], $conflict[5], '' );
>+					return false;
>+				}
>+			} else {
>+				wfDebugLog( 'antispoof', $DebugLog . "; MORE;" );
>+				if( $active ) {
>+					$message = wfMsg( 'antispoof-name-conflict', $name, $conflict[0], $conflict[1], $conflict[2], $conflict[3], $conflict[4], $conflict[5], 'and more' );
>+					return false;
>+				}
> 			}
> 		}
> 	} else {
Comment 9 OverlordQ 2008-06-27 17:42:49 UTC
Created attachment 5027 [details]
Correct patch against HEAD

Previous patch against HEAD is dirty and creates PHP errors. 

This one follows the original patch, but is against HEAD.
Comment 10 SQL 2008-06-27 18:18:34 UTC
Created attachment 5029 [details]
Patch against HEAD - Minor cleanup

Cleaned up OQ's patch (spacing, counting $conflict is no longer needed, was an experiment in formatting from a while ago)
Comment 11 Chad H. 2008-07-01 17:04:01 UTC
Latest patch applied in r36851.
Comment 12 MZMcBride 2008-07-03 06:25:56 UTC
Reverted by Brion in r36964.
Comment 13 SQL 2008-07-23 03:40:27 UTC
Resolved again in r37932 .
Comment 14 OverlordQ 2008-07-23 05:33:58 UTC
Created attachment 5090 [details]
Patch that should address brions concerns

Just in case brion reverts again, (which I think he will since r37932 still breaks the customized message stuff), I've created this patch which should address what brion wants.

Example output:
http://i36.tinypic.com/2md4aba.jpg

Default Single Conflict
Customized Single Conflict
Default Multi Conflict
Customized Multi Conflict

Patch is against the version brion reverted to.
Comment 15 OverlordQ 2008-07-24 01:10:49 UTC
Created attachment 5092 [details]
Yet another Patch

Horrible hack to use the suggested plural parser func and a listish style format which will also allow using the variables to create links/etc
Comment 16 OverlordQ 2008-07-24 01:11:10 UTC
reverted in r37938
Comment 17 Brion Vibber 2008-07-30 21:40:41 UTC
Couple notes on the patch:
* I recommend renaming $conflict to $conflicts to indicate it's an array now
* 'antispoof-conflict-top' message cannot end with a space, as that will cause troubles when customizing it (trailing space is always trimmed from wiki pages)
* You only need one {{PLURAL:...}} here; two in a row is unnecessary :)
* 'antispoof-conflict-body' is an unclear message name; I'd recommend 'antispoof-conflict-item' instead
* The hack with $wgMessageCache->transform() is unnecessary -- use wfMsgExt() with 'parsemag' option
* Just return an array consistently (empty is ok) rather than false when no matches found.
Comment 18 OverlordQ 2008-07-30 23:13:41 UTC
Created attachment 5109 [details]
Yet another Patch

Alright, same as before but hopefully addressing the critiques.
Comment 19 OverlordQ 2008-07-30 23:14:51 UTC
Comment on attachment 5109 [details]
Yet another Patch

*facepalm* forgot to mark it as patch.
Comment 20 Brion Vibber 2008-07-30 23:59:36 UTC
Looks good -- one minor nit, we seem to have lost the "Please choose another name" bit off the end. Perhaps split that also from antispoof-name-illegal and have it as a separate paragraph in both cases.

Probably not necessary to do separate formatting for the single-item and multiple-item list cases. A bullet list is fine even if it's just one -- it'll be nicely set off, and ensures that formatting is consistent and predictable.

And while we're at it -- rename getConflict() to getConflicts() just to make things pretty. :D
Comment 21 OverlordQ 2008-08-19 00:35:47 UTC
Created attachment 5196 [details]
Last one?

Hopefully address all the remaining concerns and also remove an unneeded (I think) call to isLegal.
Comment 22 X! 2008-10-20 00:28:46 UTC
Fixed in r42240

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links