aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators
diff options
context:
space:
mode:
Diffstat (limited to 'server/middlewares/validators')
-rw-r--r--server/middlewares/validators/users.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/server/middlewares/validators/users.js b/server/middlewares/validators/users.js
index 175d90bcb..e540ab0d1 100644
--- a/server/middlewares/validators/users.js
+++ b/server/middlewares/validators/users.js
@@ -25,12 +25,12 @@ function usersAdd (req, res, next) {
25} 25}
26 26
27function usersRemove (req, res, next) { 27function usersRemove (req, res, next) {
28 req.checkParams('username', 'Should have a valid username').isUserUsernameValid() 28 req.checkParams('id', 'Should have a valid id').notEmpty().isMongoId()
29 29
30 logger.debug('Checking usersRemove parameters', { parameters: req.params }) 30 logger.debug('Checking usersRemove parameters', { parameters: req.params })
31 31
32 checkErrors(req, res, function () { 32 checkErrors(req, res, function () {
33 User.loadByUsername(req.params.username, function (err, user) { 33 User.loadById(req.params.id, function (err, user) {
34 if (err) { 34 if (err) {
35 logger.error('Error in usersRemove request validator.', { error: err }) 35 logger.error('Error in usersRemove request validator.', { error: err })
36 return res.sendStatus(500) 36 return res.sendStatus(500)
@@ -44,6 +44,7 @@ function usersRemove (req, res, next) {
44} 44}
45 45
46function usersUpdate (req, res, next) { 46function usersUpdate (req, res, next) {
47 req.checkParams('id', 'Should have a valid id').notEmpty().isMongoId()
47 // Add old password verification 48 // Add old password verification
48 req.checkBody('password', 'Should have a valid password').isUserPasswordValid() 49 req.checkBody('password', 'Should have a valid password').isUserPasswordValid()
49 50