Allow session cookie domain customization

v1.18.x
Aure77 11 years ago
parent b604a4961c
commit e28ed490ee

@ -167,13 +167,19 @@ module.exports = function(app, data) {
app.use(bodyParser.json()); app.use(bodyParser.json());
app.use(cookieParser()); app.use(cookieParser());
var cookie = {
maxAge: 1000 * 60 * 60 * 24 * parseInt(meta.configs.loginDays || 14, 10)
};
var cookieDomain = nconf.get('cookie-domain');
if(cookieDomain) {
cookie.domain = cookieDomain;
}
app.use(session({ app.use(session({
store: db.sessionStore, store: db.sessionStore,
secret: nconf.get('secret'), secret: nconf.get('secret'),
key: 'express.sid', key: 'express.sid',
cookie: { cookie: cookie,
maxAge: 1000 * 60 * 60 * 24 * parseInt(meta.configs.loginDays || 14, 10)
},
resave: true, resave: true,
saveUninitialized: true saveUninitialized: true
})); }));

Loading…
Cancel
Save