This commit is contained in:
Calvin Montgomery 2017-12-10 19:28:05 -08:00
parent fbee6d2ab7
commit 1e969117c4
2 changed files with 34 additions and 4 deletions

View File

@ -2,7 +2,7 @@
"author": "Calvin Montgomery",
"name": "CyTube",
"description": "Online media synchronizer and chat",
"version": "3.51.8",
"version": "3.51.9",
"repository": {
"url": "http://github.com/calzoneman/sync"
},

View File

@ -45,7 +45,22 @@ module.exports = {
callback(err, true);
return;
}
callback(null, rows.length > 0);
let matched = null;
rows.forEach(row => {
if (row.name === name) {
matched = name;
} else if (matched === null) {
matched = row.name;
}
});
callback(
null,
rows.length > 0,
matched
);
});
},
@ -144,7 +159,7 @@ module.exports = {
return;
}
module.exports.isUsernameTaken(name, function (err, taken) {
module.exports.isUsernameTaken(name, function (err, taken, matched) {
if (err) {
delete registrationLock[lname];
callback(err, null);
@ -153,7 +168,22 @@ module.exports = {
if (taken) {
delete registrationLock[lname];
callback("Username is already registered", null);
if (matched === name) {
callback(
`Please choose a different username: "${name}" ` +
`is already registered.`,
null
);
} else {
callback(
`Please choose a different username: "${name}" ` +
`too closely matches an existing name. ` +
`For example, "Joe" (lowercase 'o'), and ` +
`"j0e" (zero) are not considered unique.`,
null
);
}
return;
}