Compare commits

..

No commits in common. "ac17b5906efba04f64e351f6f87ca4722ae1e596" and "550fa0fbe4496e19911df9bc8cd6e855b5ae7323" have entirely different histories.

1 changed files with 6 additions and 10 deletions

View File

@ -7,17 +7,13 @@ import UserService from '../services/user.js';
dotenv.config({path: ".env"});
const authenticate = async (req, res, next) => {
try {
const token = req.cookies["jwt"];
if (!token || !jwt.verify(token, process.env.SECRET)) {
req.session.destroy();
res.clearCookie("jwt");
return res.redirect("/login");
}
next();
} catch(e) {
console.log(e)
const token = req.cookies["jwt"];
if (!token || !jwt.verify(token, process.env.SECRET)) {
req.session.destroy();
res.clearCookie("jwt");
return res.redirect("/login");
}
next();
};
const validateInviteToken = async (req, res, next) => {