mirror of
https://github.com/reactos/web.git
synced 2024-11-23 03:39:49 +00:00
[ROSLOGIN] Remove all special characters during username normalization instead of replacing them by a single underscore.
There is no reason to allow an account "ColinFinck" when "Colin Finck" already exists.
This commit is contained in:
parent
c9f98c0d69
commit
83078e5615
@ -306,18 +306,18 @@
|
||||
/**
|
||||
* Returns the normalized version of the given user name.
|
||||
*
|
||||
* Normalization converts the user name to lowercase and replaces some characters.
|
||||
* Normalization converts the user name to lowercase and removes special characters.
|
||||
* These normalized names are later stored in "forbidden_usernames" and checked during account creation to prevent
|
||||
* similar accounts from being added.
|
||||
* In practice, when there is an account "Colin Finck", this prevents the creation of e.g. "Colin.Finck",
|
||||
* "__Colin-Finck" or "Colin___Finck".
|
||||
* In practice, when there is an account "Colin Finck", this prevents the creation of e.g. "ColinFinck",
|
||||
* "Colin.Finck", "__Colin-Finck" or "Colin___Finck".
|
||||
* Furthermore, MediaWiki requires all underscores to be converted to spaces, so this normalization also prevents
|
||||
* name conflicts.
|
||||
*/
|
||||
private function _normalizeUserName($username)
|
||||
{
|
||||
// Replace multiple special characters in a row by a single underscore.
|
||||
$username = preg_replace('#([\. _-]+)#', '_', $username);
|
||||
// Remove all allowed special characters.
|
||||
$username = preg_replace('#([\. _-])#', '', $username);
|
||||
|
||||
// Return the lowercased result.
|
||||
return strtolower($username);
|
||||
|
@ -31,7 +31,7 @@
|
||||
"register_sent" => "An E-Mail has been sent to <i>%s</i>.<br>Please check your inbox and follow the instructions.",
|
||||
"invalid_username" => "The Username is invalid!",
|
||||
"invalid_email" => "The E-Mail Address is invalid!",
|
||||
"in_use" => "The Username or E-Mail Address is already in use!",
|
||||
"in_use" => "This or a similar Username or E-Mail Address is already in use!",
|
||||
"captcha_not_solved" => "The CAPTCHA has not been solved!",
|
||||
|
||||
"confirm_title" => "E-Mail Address Confirmation",
|
||||
|
Loading…
Reference in New Issue
Block a user