Merge branch 'sabrecat/usernames-master' into develop

This commit is contained in:
Sabe Jones
2018-11-14 08:21:49 -06:00
62 changed files with 1850 additions and 594 deletions

View File

@@ -28,12 +28,14 @@ api.verifyUsername = {
const issues = verifyUsername(chosenUsername, res);
const existingUser = await User.findOne({
'auth.local.lowerCaseUsername': chosenUsername.toLowerCase(),
}, {auth: 1}).exec();
if (issues.length < 1) {
const existingUser = await User.findOne({
'auth.local.lowerCaseUsername': chosenUsername.toLowerCase(),
}, {auth: 1}).exec();
if (existingUser) {
if (!user || existingUser._id !== user._id) issues.push(res.t('usernameTaken'));
if (existingUser) {
if (!user || existingUser._id !== user._id) issues.push(res.t('usernameTaken'));
}
}
if (issues.length > 0) {