make cookies more durable

This commit is contained in:
Avris 2021-08-27 12:30:42 +02:00
parent 97d2b32f57
commit 3ee4bdd930
2 changed files with 7 additions and 2 deletions

View File

@ -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,
}));

View File

@ -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,
}