mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 06:37:23 +01:00
start upgrading eslint
This commit is contained in:
@@ -3,7 +3,7 @@ import {
|
||||
} from '../../middlewares/auth';
|
||||
import * as authLib from '../../libs/auth';
|
||||
import { model as User } from '../../models/user';
|
||||
import {verifyUsername} from '../../libs/user/validation';
|
||||
import { verifyUsername } from '../../libs/user/validation';
|
||||
|
||||
const api = {};
|
||||
|
||||
@@ -16,14 +16,14 @@ api.verifyUsername = {
|
||||
async handler (req, res) {
|
||||
req.checkBody({
|
||||
username: {
|
||||
notEmpty: {errorMessage: res.t('missingUsername')},
|
||||
notEmpty: { errorMessage: res.t('missingUsername') },
|
||||
},
|
||||
});
|
||||
|
||||
const validationErrors = req.validationErrors();
|
||||
if (validationErrors) throw validationErrors;
|
||||
|
||||
const user = res.locals.user;
|
||||
const { user } = res.locals;
|
||||
const chosenUsername = req.body.username;
|
||||
|
||||
const issues = verifyUsername(chosenUsername, res);
|
||||
@@ -31,10 +31,10 @@ api.verifyUsername = {
|
||||
if (issues.length < 1) {
|
||||
const existingUser = await User.findOne({
|
||||
'auth.local.lowerCaseUsername': chosenUsername.toLowerCase(),
|
||||
}, {auth: 1}).exec();
|
||||
}, { auth: 1 }).exec();
|
||||
|
||||
if (existingUser) {
|
||||
if (!user || existingUser._id !== user._id) issues.push(res.t('usernameTaken'));
|
||||
if (!user || existingUser._id !== user._id) issues.push(res.t('usernameTaken'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user