Register added

This commit is contained in:
NyxiumYuuki 2021-05-28 11:55:45 +02:00
parent 66e7e0b48d
commit cb537f7c7f
6 changed files with 49 additions and 15 deletions

View file

@ -30,11 +30,10 @@ async function authenticate(req, res) {
const login = req.body.login;
const password = req.body.password;
const userList = await queries.checkLoginQuery(login, password);
if (userList !== undefined && userList[0] !== undefined && userList[0].idUtilisateur > 0){
console.log("check");
const user = await queries.checkLoginQuery(login, password);
if (user === 1){
setSessionCookie (req, res, { username: login});
return userList[0].idUtilisateur;
return user;
} else {
setSessionCookie (req, res, {username: -1});
return -1;