From ad4a8a1cca1049f600ebcdce9260c1021cd821a5 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Sat, 18 Feb 2017 09:29:59 +0100 Subject: Add email to users --- server/middlewares/validators/users.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'server/middlewares') diff --git a/server/middlewares/validators/users.js b/server/middlewares/validators/users.js index 0629550bc..3089370ff 100644 --- a/server/middlewares/validators/users.js +++ b/server/middlewares/validators/users.js @@ -13,11 +13,12 @@ const validatorsUsers = { function usersAdd (req, res, next) { req.checkBody('username', 'Should have a valid username').isUserUsernameValid() req.checkBody('password', 'Should have a valid password').isUserPasswordValid() + req.checkBody('email', 'Should have a valid email').isEmail() logger.debug('Checking usersAdd parameters', { parameters: req.body }) checkErrors(req, res, function () { - db.User.loadByUsername(req.body.username, function (err, user) { + db.User.loadByUsernameOrEmail(req.body.username, req.body.email, function (err, user) { if (err) { logger.error('Error in usersAdd request validator.', { error: err }) return res.sendStatus(500) -- cgit v1.2.3