diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-10-07 15:32:09 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-10-07 15:32:09 +0200 |
commit | af1068ce1d1ca7ecaea5789ece1566987ce712ef (patch) | |
tree | 1e4babed3ba16f6abd537799636991b068bac2ea /server/middlewares/validators | |
parent | b9ab2e25fd7fff1ded999153371fb4699c9abaf1 (diff) | |
download | PeerTube-af1068ce1d1ca7ecaea5789ece1566987ce712ef.tar.gz PeerTube-af1068ce1d1ca7ecaea5789ece1566987ce712ef.tar.zst PeerTube-af1068ce1d1ca7ecaea5789ece1566987ce712ef.zip |
Server: forbid to remove the root user
Diffstat (limited to 'server/middlewares/validators')
-rw-r--r-- | server/middlewares/validators/users.js | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/server/middlewares/validators/users.js b/server/middlewares/validators/users.js index d541e9124..02e4f34cb 100644 --- a/server/middlewares/validators/users.js +++ b/server/middlewares/validators/users.js | |||
@@ -47,6 +47,8 @@ function usersRemove (req, res, next) { | |||
47 | 47 | ||
48 | if (!user) return res.status(404).send('User not found') | 48 | if (!user) return res.status(404).send('User not found') |
49 | 49 | ||
50 | if (user.username === 'root') return res.status(400).send('Cannot remove the root user') | ||
51 | |||
50 | next() | 52 | next() |
51 | }) | 53 | }) |
52 | }) | 54 | }) |