aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-08-09 21:44:45 +0200
committerChocobozzz <florian.bigard@gmail.com>2016-08-09 21:44:45 +0200
commit68a3b9f2aacb0225ae8b883b561b144bac339cbd (patch)
treee3d75b7952073ba4b2ef4b62ed57ded9f3cf0f1e /server/middlewares
parent45b81debd6d6647980da7ad5a984bafa37cb79ea (diff)
downloadPeerTube-68a3b9f2aacb0225ae8b883b561b144bac339cbd.tar.gz
PeerTube-68a3b9f2aacb0225ae8b883b561b144bac339cbd.tar.zst
PeerTube-68a3b9f2aacb0225ae8b883b561b144bac339cbd.zip
Server: delete user with the id and not the username
Diffstat (limited to 'server/middlewares')
-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