Skip to content

Commit

Permalink
#703 - Fixes race condition when using express-session with custom store
Browse files Browse the repository at this point in the history
fixes #703
  • Loading branch information
pragmaticivan committed Dec 15, 2018
1 parent 882d65e commit 6bd689c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/sessionmanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,16 @@ SessionManager.prototype.logIn = function(req, user, cb) {
req.session = {};
}
req.session[self._key] = req._passport.session;
cb();
if (typeof req.session.save == 'function') {
req.session.save(function () {
if (err) {
cb(err);
}
cb();
});
} else {
cb();
}
});
}

Expand Down

0 comments on commit 6bd689c

Please sign in to comment.