Fix underscore escaping for similar chars check
This commit is contained in:
parent
06347d6c25
commit
817e7ceb84
|
@ -13,7 +13,7 @@ var blackHole = function () { };
|
|||
* visually identical to existing names in certain fonts.
|
||||
*/
|
||||
function wildcardSimilarChars(name) {
|
||||
return name.replace(/[Il1oO0]/g, "_");
|
||||
return name.replace(/_/g, "\\_").replace(/[Il1oO0]/g, "_");
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
@ -24,7 +24,8 @@ module.exports = {
|
|||
* Check if a username is taken
|
||||
*/
|
||||
isUsernameTaken: function (name, callback) {
|
||||
db.query("SELECT name FROM `users` WHERE name LIKE ?", [wildcardSimilarChars(name)],
|
||||
db.query("SELECT name FROM `users` WHERE name LIKE ? ESCAPE '\\\\'",
|
||||
[wildcardSimilarChars(name)],
|
||||
function (err, rows) {
|
||||
if (err) {
|
||||
callback(err, true);
|
||||
|
|
Loading…
Reference in a new issue