0
The function of this code is to receive the login data through the req
and do with query to see if the records exist and the user can access certain area, but the code below not be indifferent as much as type the correct data in the form, how much type the wrong data in the form.
routeradmin.post('/envlogin', function (req, res) {
dadoslogin.findAll({
where: {
email: req.body
senha: {
[Op.and]: req.body.senhauser
}
}, raw: "true"
}).then(
function () {
res.send("deu certo");
}).catch(function (error) {
res.send("deu errado");
});
});
As the query in my vision would return the value or not, I used .then
and .cacth
to process the chances of outcome.