From 106b0bac9d41ba5b96ce06fc08ea7430902efe0f Mon Sep 17 00:00:00 2001 From: Avris Date: Sat, 28 Aug 2021 01:19:20 +0200 Subject: [PATCH] cookies - try to fix issues with social login --- server/index.js | 3 ++- src/cookieSettings.js | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/server/index.js b/server/index.js index 6fe6af86..770d11f8 100644 --- a/server/index.js +++ b/server/index.js @@ -7,6 +7,7 @@ import grant from "grant"; import router from "./routes/user"; import { loadSuml } from './loader'; import {isGranted} from "../src/helpers"; +import cookieSettings from "../src/cookieSettings"; global.config = loadSuml('config'); @@ -25,7 +26,7 @@ app.use(express.urlencoded({ extended: true })); app.use(cookieParser()); app.use(session({ secret: process.env.SECRET, - cookie: {}, + cookie: cookieSettings, resave: false, saveUninitialized: false, })); diff --git a/src/cookieSettings.js b/src/cookieSettings.js index 78f1dfd1..85df5b00 100644 --- a/src/cookieSettings.js +++ b/src/cookieSettings.js @@ -1,3 +1,7 @@ +const inAYear = new Date(); +inAYear.setFullYear(inAYear.getFullYear() + 1); + export default { - maxAge: 365 * 24 * 60 * 60, + // secure: process.env.NODE_ENV === 'production', + expires: inAYear, }