null check user during logout

This commit is contained in:
Henry Oswald 2017-08-03 13:26:14 +01:00
parent 35f31d5a3c
commit 33fe252a15

View file

@ -120,8 +120,9 @@ module.exports = UserController =
req.session.destroy (err)->
if err
logger.err err: err, 'error destorying session'
UserSessionsManager.untrackSession(user, sessionId)
SudoModeHandler.clearSudoMode(user._id)
if user?
UserSessionsManager.untrackSession(user, sessionId)
SudoModeHandler.clearSudoMode(user._id)
res.redirect '/login'
register : (req, res, next = (error) ->)->