This commit is contained in:
Lukian LEIZOUR 2024-06-06 13:53:44 +02:00
parent cd74f8e71b
commit d4d7f51d03
6 changed files with 58 additions and 7 deletions

View file

@ -19,9 +19,13 @@ router.post('/', async (req, res) => {
return res.status(400).send({error: "wrong login informations"});
}
console.log(user);
if (!user[0].verified) {
return res.status(400).send({error: "you need to be verified to login"})
}
res.status(200).send({message: "connection successful", token: jwt.sign({user: {id: user[0].id, username: user[0].username, name: user[0].name, lastname: user[0].lastname}, expiration: 20000}, process.env.JWTSecret)});
const expiration = new Date().getTime() + 1000 * 60 * 60 * 24 * 7;
res.status(200).send({message: "connection successful", token: jwt.sign({user: {id: user[0].id, username: user[0].username, name: user[0].name, lastname: user[0].lastname}, expiration: 2000}, process.env.JWTSecret)});
});
module.exports = router;