summaryrefslogtreecommitdiff
path: root/middlewares/requireAuth.js
diff options
context:
space:
mode:
authorJulien Dessaux2022-10-30 23:16:47 +0100
committerJulien Dessaux2022-10-30 23:16:47 +0100
commitdc5a002144ff7165e73fb38f4be186d827df98c6 (patch)
treec121abb7e34ae56adb33ca612d5ced962b411b63 /middlewares/requireAuth.js
parentAdded a basic database schema and migration function (diff)
downloadjeux-de-mots-dc5a002144ff7165e73fb38f4be186d827df98c6.tar.gz
jeux-de-mots-dc5a002144ff7165e73fb38f4be186d827df98c6.tar.bz2
jeux-de-mots-dc5a002144ff7165e73fb38f4be186d827df98c6.zip
Added register and login database functions, and use the last one in the login route
Diffstat (limited to 'middlewares/requireAuth.js')
-rw-r--r--middlewares/requireAuth.js2
1 files changed, 1 insertions, 1 deletions
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");