Skip to content

Commit

Permalink
Better session detection and exceptions.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredhanson committed May 19, 2022
1 parent 80cc4e3 commit 294f22c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/sessionmanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,14 @@ SessionManager.prototype.logIn = function(req, user, cb) {
SessionManager.prototype.logOut = function(req, cb) {
console.log('SM: logOut');

if (!req.session) { return cb(new Error('Login sessions require session support. Did you forget to use `express-session` middleware?')); }

var self = this;

// clear the user from the session object and save.
// this will ensure that re-using the old session id
// does not have a logged in user
if (req.session && req.session[this._key]) {
if (req.session[this._key]) {
delete req.session[this._key].user;
}

Expand Down

0 comments on commit 294f22c

Please sign in to comment.