02 - Sign In Bcrypt
ADDING BCRYPT TO SIGNIN
bcrypt.compare()
router.post('/signin', function (req, res) {
User.findOne({ where: { username: req.body.user.username } }).then(
function (user) {
//1
if (user) {
//2 //3 //4 //5
bcrypt.compare(req.body.user.password, user.passwordhash, function (err, matches) {
console.log("The value matches:", matches); //6
});
} else { //7
res.status(500).send({ error: "failed to authenticate" });
}
},
function (err) {
res.status(501).send({ error: "you failed, yo" });
}
);
});What Did We Just Do?
Test
Last updated