Merge pull request #570 from sharelatex/ho-null-check-redis-sessions

Ho null check redis sessions
This commit is contained in:
James Allen 2017-08-29 15:44:22 +02:00 committed by GitHub
commit a58a715fad
2 changed files with 5 additions and 4 deletions

View file

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

View file

@ -114,7 +114,7 @@ module.exports = UserSessionsManager =
callback(null)
touch: (user, callback=(err)->) ->
if !user
if !user?
logger.log {}, "no user to touch sessions for, returning"
return callback(null)
sessionSetKey = UserSessionsRedis.sessionSetKey(user)
@ -125,7 +125,7 @@ module.exports = UserSessionsManager =
callback(null)
_checkSessions: (user, callback=(err)->) ->
if !user
if !user?
logger.log {}, "no user, returning"
return callback(null)
logger.log {user_id: user._id}, "checking sessions for user"