From dc5a002144ff7165e73fb38f4be186d827df98c6 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Sun, 30 Oct 2022 23:16:47 +0100 Subject: Added register and login database functions, and use the last one in the login route --- middlewares/requireAuth.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'middlewares/requireAuth.js') diff --git a/middlewares/requireAuth.js b/middlewares/requireAuth.js index 3cf10ec..7e74339 100644 --- a/middlewares/requireAuth.js +++ b/middlewares/requireAuth.js @@ -1,5 +1,5 @@ function requireAuth(req, res, next) { - if (req.session.userId) { + if (req.session.user !== undefined) { next(); } res.redirect(302, "/login"); -- cgit v1.2.3