Commit 28e71486 authored by pdg16's avatar pdg16
Browse files

change status code in edit responses

parent cacf784b
Pipeline #20710 failed with stage
in 1 minute and 30 seconds
......@@ -290,13 +290,13 @@ userApp.put('/', passport.authenticate('bearer', { session: false }), (req, res,
if (user.checkPassword(req.body.password)) {
user.password = req.body.newpassword;
} else {
res.statusCode = 500;
res.statusCode = 400;
return res.json({error: {
message: 'A senha atual está incorreta'
}});
}
} else {
res.statusCode = 500;
res.statusCode = 400;
return res.json({error: {
message: 'A nova senha é a mesma da senha atual'
}});
......@@ -306,7 +306,7 @@ userApp.put('/', passport.authenticate('bearer', { session: false }), (req, res,
user.save(err => {
if(err) {
log.error(err);
res.statusCode = 500;
res.statusCode = 400;
return res.json({error: {
message: 'Email já cadastrado'
}});
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment