fix(usernames): various

Better modal positioning
Correct text colors for input field
Don't show "already taken" if username has other errors
This commit is contained in:
Sabe Jones
2018-10-15 11:27:49 -05:00
parent 0897ab5dc9
commit cfd19ac694
2 changed files with 27 additions and 11 deletions

View File

@@ -90,12 +90,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) {