diff options
Diffstat (limited to 'server/middlewares/validators')
-rw-r--r-- | server/middlewares/validators/users.js | 3 |
1 files changed, 2 insertions, 1 deletions
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 = { | |||
13 | function usersAdd (req, res, next) { | 13 | function usersAdd (req, res, next) { |
14 | req.checkBody('username', 'Should have a valid username').isUserUsernameValid() | 14 | req.checkBody('username', 'Should have a valid username').isUserUsernameValid() |
15 | req.checkBody('password', 'Should have a valid password').isUserPasswordValid() | 15 | req.checkBody('password', 'Should have a valid password').isUserPasswordValid() |
16 | req.checkBody('email', 'Should have a valid email').isEmail() | ||
16 | 17 | ||
17 | logger.debug('Checking usersAdd parameters', { parameters: req.body }) | 18 | logger.debug('Checking usersAdd parameters', { parameters: req.body }) |
18 | 19 | ||
19 | checkErrors(req, res, function () { | 20 | checkErrors(req, res, function () { |
20 | db.User.loadByUsername(req.body.username, function (err, user) { | 21 | db.User.loadByUsernameOrEmail(req.body.username, req.body.email, function (err, user) { |
21 | if (err) { | 22 | if (err) { |
22 | logger.error('Error in usersAdd request validator.', { error: err }) | 23 | logger.error('Error in usersAdd request validator.', { error: err }) |
23 | return res.sendStatus(500) | 24 | return res.sendStatus(500) |