mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-04 06:39:02 +02:00
[web] Update revokeAllUserSessions and rename it to removeSessionsFromRedis (#18360)
* Fix `revokeAllUserSessions` call in `_cleanupUser` The user object should be passed, not the _id * Change `revokeAllUserSessions` signature, take `req` and `stayLoggedIn` arguments * Update uses of `revokeAllUserSessions` * Fix promisified `revokeAllUserSessions` args * Update tests * Destroy or Regenerate the session in the end of `revokeAllUserSessions` Per https://github.com/overleaf/internal/issues/17036#issuecomment-1938398570 * Revert "Destroy or Regenerate the session in the end of `revokeAllUserSessions`" This reverts commit fe30734dbe45b27d2931d2e43a711d591bb85787. * Rename `revokeAllUserSessions` to `removeSessionsFromRedis` * Fixup tests * Fix: add optional chaining in `req.sessionID` (!!) GitOrigin-RevId: d41676bf00f463230af495e09c65fb9ee521f49f
This commit is contained in:
@@ -38,7 +38,7 @@ describe('UserEmailsController', function () {
|
||||
hasFeature: sinon.stub(),
|
||||
}
|
||||
this.UserSessionsManager = {
|
||||
revokeAllUserSessions: sinon.stub().yields(),
|
||||
removeSessionsFromRedis: sinon.stub().yields(),
|
||||
}
|
||||
this.UserUpdater = {
|
||||
addEmailAddress: sinon.stub(),
|
||||
@@ -565,8 +565,8 @@ describe('UserEmailsController', function () {
|
||||
|
||||
this.res.callback = () => {
|
||||
expect(
|
||||
this.UserSessionsManager.revokeAllUserSessions
|
||||
).to.have.been.calledWith(this.user, [this.req.sessionID])
|
||||
this.UserSessionsManager.removeSessionsFromRedis
|
||||
).to.have.been.calledWith(this.user, this.req)
|
||||
done()
|
||||
}
|
||||
|
||||
@@ -576,7 +576,7 @@ describe('UserEmailsController', function () {
|
||||
it('handles error from revoking sessions and returns 200', function (done) {
|
||||
this.UserUpdater.setDefaultEmailAddress.yields()
|
||||
const redisError = new Error('redis error')
|
||||
this.UserSessionsManager.revokeAllUserSessions = sinon
|
||||
this.UserSessionsManager.removeSessionsFromRedis = sinon
|
||||
.stub()
|
||||
.yields(redisError)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user