Is it possible to create a filter for the MediaWiki AbuseFilter extension that disallows user names with special characters?

I'm having a recurring vandal problem and basically I want to only allow usernames with characters A through Z and 0 through 9.

Is this possible?

1

There are 1 best solutions below

0
InSync On

Yes, with action === 'createaccount':

action === 'createaccount' &
accountname rlike '[^A-Z0-9]'

Basically, this checks if a createaccount action has an accountname that matches the regex [^A-Z0-9], and block it if the result is true. See the documentation page for more information about rules.

Note that this also disallow spaces (underscores are normalized as spaces) and lowercase letters. If this is not what you want, change the regex to [^A-Za-z0-9 ].

Alternatively, you can place the following line into your MediaWiki:Titleblacklist page:

.*[^a-z0-9 ].*  <newaccountonly>

TitleBlacklist is case-insensitive by default, so A-Z is not necessary here. However, depending on your needs you might want to modify that by using the casesensitive specifier: <newaccountonly|casesensitive>.