Mise à jour de routes
This commit is contained in:
+7
-1
@@ -36,6 +36,9 @@ router.put('/user', auth.required, function (req, res, next) {
|
||||
if (typeof req.body.user.licence !== 'undefined') {
|
||||
user.licence = req.body.user.licence;
|
||||
}
|
||||
if (typeof req.body.user.poids !== 'undefined') {
|
||||
user.poids = req.body.user.poids;
|
||||
}
|
||||
if (typeof req.body.user.image !== 'undefined') {
|
||||
user.image = req.body.user.image;
|
||||
}
|
||||
@@ -106,8 +109,11 @@ router.post('/users', function (req, res, next) {
|
||||
if (typeof req.body.user.licence !== 'undefined') {
|
||||
user.licence = req.body.user.licence;
|
||||
}
|
||||
if (typeof req.body.user.poids !== 'undefined') {
|
||||
user.poids = req.body.user.poids;
|
||||
}
|
||||
user.setPassword(req.body.user.password);
|
||||
user.role = 'User'; // valeurs possibles : 'User' or 'Admin'
|
||||
user.role = 'User';
|
||||
|
||||
user.save().then(function () {
|
||||
return res.json({ user: user.toAuthJSON() });
|
||||
|
||||
Reference in New Issue
Block a user