From ef3fa9ae3eeadacdfca3f411e3b9edc8179348a3 Mon Sep 17 00:00:00 2001 From: Nareshkumar Rao Date: Thu, 29 Jul 2021 00:37:06 +0200 Subject: [PATCH] fixed cookie and verify --- src/db/db.js | 3 +-- src/routes/VerifyRoute.js | 4 +--- src/session.js | 1 + 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/db/db.js b/src/db/db.js index f65f7cd..57ba5e9 100644 --- a/src/db/db.js +++ b/src/db/db.js @@ -37,8 +37,7 @@ const storeDB = (() => { })(); const store = new SequelizeStore({ - db: storeDB, - expiration: process.env.COOKIE_EXPIRY_DURATION, + db: storeDB }); const Contact = sequelize.define("Contact", { diff --git a/src/routes/VerifyRoute.js b/src/routes/VerifyRoute.js index 0611de9..7a984ba 100644 --- a/src/routes/VerifyRoute.js +++ b/src/routes/VerifyRoute.js @@ -1,8 +1,7 @@ const { User } = require("../db/db"); const { addContact } = require("../db/utils"); -function VerifyRoute() { - (req, res) => { +function VerifyRoute(req, res) { checkVerification(req.body.id, (success, msg, withUserID) => { req.session.verified = success; req.session.verifiedBy = withUserID; @@ -23,7 +22,6 @@ function VerifyRoute() { res.status(400).send({ success: success, message: msg }); } }); - }; } function checkVerification(id, done) { diff --git a/src/session.js b/src/session.js index aa81029..4812e45 100644 --- a/src/session.js +++ b/src/session.js @@ -7,6 +7,7 @@ const sessionOpts = { cookie: { secure: true, sameSite: "none", + maxAge: Number(process.env.SESSION_LENGTH), }, store: store, };