mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-25 06:51:39 +00: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)->) ->
|
revokeAllSessions: (user, callback=(err)->) ->
|
||||||
logger.log {user_id: user._id}, "revoking all existing sessions for user"
|
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)
|
callback(null)
|
||||||
|
|
||||||
touch: (user, callback=(err)->) ->
|
touch: (user, callback=(err)->) ->
|
||||||
|
|
Loading…
Reference in a new issue