Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Factor logout into session manager.
  • Loading branch information
jaredhanson committed Aug 11, 2017
1 parent 997dc51 commit c5bde3f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/http/request.js
Expand Up @@ -69,8 +69,8 @@ req.logOut = function() {
}

this[property] = null;
if (this._passport && this._passport.session) {
delete this._passport.session.user;
if (this._passport) {
this._passport.instance._sm.logOut(this);
}
};

Expand Down
7 changes: 7 additions & 0 deletions lib/sessionmanager.js
Expand Up @@ -28,5 +28,12 @@ SessionManager.prototype.logIn = function(req, user, cb) {
});
}

SessionManager.prototype.logOut = function(req, cb) {
if (req._passport && req._passport.session) {
delete req._passport.session.user;
}
cb && cb();
}


module.exports = SessionManager;

0 comments on commit c5bde3f

Please sign in to comment.