truly fixed registration

This commit is contained in:
leca 2024-10-26 15:34:37 +03:00
parent 1c65166776
commit e78f20d44e
1 changed files with 1 additions and 1 deletions

View File

@ -20,7 +20,7 @@ const usernameDoesntExist = async (req, res, next) => {
let { username } = req.body; let { username } = req.body;
let user = await UserService.getByUsername(username); let user = await UserService.getByUsername(username);
if (user != statuses.not_found) return res.status(400).send("Such username already taken"); if (user != undefined && user != statuses.not_found) return res.status(400).send("Such username already taken");
next(); next();
} catch (e) { return res.status(500).send(log.unknownError(`${TAG}/usernameDoesntExist: ${e}`)); } } catch (e) { return res.status(500).send(log.unknownError(`${TAG}/usernameDoesntExist: ${e}`)); }
} }