Compare commits
No commits in common. "ac17b5906efba04f64e351f6f87ca4722ae1e596" and "550fa0fbe4496e19911df9bc8cd6e855b5ae7323" have entirely different histories.
ac17b5906e
...
550fa0fbe4
|
@ -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) => {
|
||||
|
|
Loading…
Reference in New Issue