mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-06 07: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:
@@ -91,7 +91,7 @@ describe('UserController', function () {
|
||||
this.UserSessionsManager = {
|
||||
promises: {
|
||||
getAllUserSessions: sinon.stub().resolves(),
|
||||
revokeAllUserSessions: sinon.stub().resolves(),
|
||||
removeSessionsFromRedis: sinon.stub().resolves(),
|
||||
untrackSession: sinon.stub().resolves(),
|
||||
},
|
||||
}
|
||||
@@ -603,9 +603,9 @@ describe('UserController', function () {
|
||||
|
||||
describe('clearSessions', function () {
|
||||
describe('success', function () {
|
||||
it('should call revokeAllUserSessions', function (done) {
|
||||
it('should call removeSessionsFromRedis', function (done) {
|
||||
this.res.sendStatus.callsFake(() => {
|
||||
this.UserSessionsManager.promises.revokeAllUserSessions.should.have
|
||||
this.UserSessionsManager.promises.removeSessionsFromRedis.should.have
|
||||
.been.calledOnce
|
||||
done()
|
||||
})
|
||||
@@ -662,9 +662,9 @@ describe('UserController', function () {
|
||||
})
|
||||
})
|
||||
|
||||
describe('when revokeAllUserSessions produces an error', function () {
|
||||
describe('when removeSessionsFromRedis produces an error', function () {
|
||||
it('should call next with an error', function (done) {
|
||||
this.UserSessionsManager.promises.revokeAllUserSessions.rejects(
|
||||
this.UserSessionsManager.promises.removeSessionsFromRedis.rejects(
|
||||
new Error('woops')
|
||||
)
|
||||
this.UserController.clearSessions(this.req, this.res, error => {
|
||||
|
||||
Reference in New Issue
Block a user