Skip to content

Commit 12e4b76

Browse files
authored
Try a rolling session middleware (#1244)
* Alternative is "Remember me" option although I think I'd rather have a "Forget me" option by default. Post #1202 and related to #604 Auto-merge
1 parent a351adf commit 12e4b76

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

app.js

+9
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,15 @@ app.use(function (aReq, aRes, aNext) {
305305
aNext();
306306
});
307307
app.use(modifySessions.init(sessionStore));
308+
309+
// Rolling user session
310+
app.use(function (aReq, aRes, aNext) {
311+
if (aReq.session.user) {
312+
aReq.session.user._touched = new Date();
313+
}
314+
aNext();
315+
});
316+
308317
app.use(favicon(__dirname + '/public/images/favicon.ico'));
309318

310319
// Set up the views

0 commit comments

Comments
 (0)