Browse Source

fixed cookie and verify

cleanup/break-apart-app-js
Nareshkumar Rao 3 years ago
parent
commit
ef3fa9ae3e
  1. 3
      src/db/db.js
  2. 4
      src/routes/VerifyRoute.js
  3. 1
      src/session.js

3
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", {

4
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) {

1
src/session.js

@ -7,6 +7,7 @@ const sessionOpts = {
cookie: {
secure: true,
sameSite: "none",
maxAge: Number(process.env.SESSION_LENGTH),
},
store: store,
};

Loading…
Cancel
Save