lowercase permissions

master
Kit Kasune 2 years ago
parent 3c50485669
commit 215c458b56
  1. 4
      api/ani/v1/routes/user.js

@ -30,7 +30,7 @@ module.exports = (app, router) => {
const newUser = new Users({ const newUser = new Users({
id: req.params.id.toLowerCase(), id: req.params.id.toLowerCase(),
name: req.body.name, name: req.body.name,
permissions: req.body.permissions, permissions: req.body.permissions.map(permission => permission.toLowerCase()),
discord: req.body.discord, discord: req.body.discord,
password: hashSync(req.body.password, 8) password: hashSync(req.body.password, 8)
}); });
@ -93,5 +93,5 @@ module.exports = (app, router) => {
req.user.permissions = permissions; req.user.permissions = permissions;
req.user.markModified('permissions'); req.user.markModified('permissions');
await req.user.save(); await req.user.save();
}, (req, res, next) => {if (!req.authenticatedUser) {return res.status(401).send("You must be authenticated before you do that!");} next();})); }, (req, res, next) => {if (!req.authenticatedUser) {return res.status(401).send("You must be authenticated before you do that!");} return next();}));
}; };
Loading…
Cancel
Save