This commit is contained in:
Lukian LEIZOUR 2024-06-01 19:14:23 +02:00
parent 0bac40a72f
commit 8ace4a6356
6 changed files with 32 additions and 7 deletions

View file

@ -12,11 +12,11 @@ router.post('/', async (req, res) => {
const user = await getUser(username);
if (!user[0]) {
return res.status(500).send({error: "wrong login informations"});
return res.status(400).send({error: "wrong login informations"});
}
if (!(sha256(password) == user[0].password)) {
return res.status(500).send({error: "wrong login informations"});
return res.status(400).send({error: "wrong login informations"});
}
res.status(200).send({message: "connection successful", token: jwt.sign({username: username, expiration: 20000}, process.env.JWTSecret)});