Skip to content

Commit

Permalink
Add call back function to support passportjs package. expand for more…
Browse files Browse the repository at this point in the history
… details...

  /*
    Addressing issue with latest version of passport dependency packge
    TypeError: req.session.regenerate is not a function
    Reference: jaredhanson/passport#907 (comment)
  */
  • Loading branch information
malikimran34 committed Oct 19, 2023
1 parent e1b6e34 commit 949300b
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,25 @@ const init = async () => {
app.use(setUserContext);
app.use(setConfigContext);

/*
Addressing issue with latest version of passport dependency packge
TypeError: req.session.regenerate is not a function
Reference: https://github.com/jaredhanson/passport/issues/907#issuecomment-1697590189
*/
app.use((request, response, next) => {
if (request.session && !request.session.regenerate) {
request.session.regenerate = (cb) => {
cb();
};
}
if (request.session && !request.session.save) {
request.session.save = (cb) => {
cb();
};
}
next();
});

registerRoutes(app, csrf);

const errorPageRenderer = ejsErrorPages.getErrorPageRenderer(
Expand Down

0 comments on commit 949300b

Please sign in to comment.