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

View file

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