aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-02-18 09:29:59 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-02-18 09:29:59 +0100
commitad4a8a1cca1049f600ebcdce9260c1021cd821a5 (patch)
treeca8ffba899b024d56d1bd7846f61aecae0821c82 /server/middlewares
parent5d67f289df4a68e35ad7e0af3c601c7db0dc7586 (diff)
downloadPeerTube-ad4a8a1cca1049f600ebcdce9260c1021cd821a5.tar.gz
PeerTube-ad4a8a1cca1049f600ebcdce9260c1021cd821a5.tar.zst
PeerTube-ad4a8a1cca1049f600ebcdce9260c1021cd821a5.zip
Add email to users
Diffstat (limited to 'server/middlewares')
-rw-r--r--server/middlewares/validators/users.js3
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 = {
13function usersAdd (req, res, next) { 13function 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)