mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Clear out sessions
This commit is contained in:
parent
5ae0aeaf94
commit
8855d0fa0f
1 changed files with 14 additions and 1 deletions
|
@ -43,6 +43,19 @@ module.exports = UserSessionsManager =
|
|||
|
||||
revokeAllSessions: (user, callback=(err)->) ->
|
||||
logger.log {user_id: user._id}, "revoking all existing sessions for user"
|
||||
sessionSetKey = UserSessionsManager._sessionSetKey(user)
|
||||
rclient.smembers sessionSetKey, (err, sessionKeys) ->
|
||||
if err
|
||||
logger.err {err, user_id: user._id, sessionSetKey}, "error getting contents of UserSessions set"
|
||||
return callback(err)
|
||||
logger.log {user_id: user._id, count: sessionKeys.length}, "deleting sessions for user"
|
||||
rclient.multi()
|
||||
.del(sessionKeys)
|
||||
.srem(sessionSetKey, sessionKeys)
|
||||
.exec (err, result) ->
|
||||
if err
|
||||
logger.err {err, user_id: user._id, sessionSetKey}, "error revoking all sessions for user"
|
||||
return callback(err)
|
||||
callback(null)
|
||||
|
||||
touch: (user, callback=(err)->) ->
|
||||
|
|
Loading…
Reference in a new issue