yes I was
This commit is contained in:
@@ -39,12 +39,14 @@ checkDuplicateUsernameOrEmail = (req, res, next) => {
|
||||
|
||||
checkRolesExisted = (req, res, next) => {
|
||||
if (req.body.roles) {
|
||||
for (let i = 0; i < req.body.roles.length; i++) {
|
||||
if (!ROLES.includes(req.body.roles[i])) {
|
||||
res.status(400).send({
|
||||
message: `oof! ce role ${req.body.roles[i]} n'existe pas`
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
next();
|
||||
@@ -75,14 +77,12 @@ validateEmail = async (req, res, next) => {
|
||||
|
||||
checkPassLimit = (req, res, next) => {
|
||||
if (req.body.password) {
|
||||
for (let i = 0; i < req.body.password.length; i++) {
|
||||
if (req.body.password.length <= 8) {
|
||||
res.status(400).send({
|
||||
message: "oof! ce password ne respecte pas les limitations en cours."
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
next();
|
||||
|
||||
Reference in New Issue
Block a user