Merge pull request #2993 from overleaf/jpa-drop-private-api-usage

[misc] launchpad: refactor private api usage of AuthenticationController

GitOrigin-RevId: 74585bcf7bf7483ae19af7b341e1173293d667fe
This commit is contained in:
Hugh O'Brien 2020-07-13 12:24:17 +01:00 committed by Copybot
parent eaa7491c2b
commit ff2ee573bb
2 changed files with 6 additions and 3 deletions

View file

@ -54,7 +54,8 @@ module.exports = LaunchpadController = {
authMethod
})
} else {
return AuthenticationController._redirectToLoginPage(req, res)
AuthenticationController.setRedirectInSession(req)
return res.redirect('/login')
}
} else {
return UserGetter.getUser(sessionUser._id, { isAdmin: 1 }, function(

View file

@ -62,6 +62,7 @@ describe('LaunchpadController', function() {
this.res = {
render: sinon.stub(),
redirect: sinon.stub(),
send: sinon.stub(),
sendStatus: sinon.stub()
}
@ -75,7 +76,7 @@ describe('LaunchpadController', function() {
this.LaunchpadController,
'_atLeastOneAdminExists'
)
return (this.AuthenticationController._redirectToLoginPage = sinon.stub())
return (this.AuthenticationController.setRedirectInSession = sinon.stub())
})
afterEach(function() {
@ -126,9 +127,10 @@ describe('LaunchpadController', function() {
})
it('should redirect to login page', function() {
return this.AuthenticationController._redirectToLoginPage.callCount.should.equal(
this.AuthenticationController.setRedirectInSession.callCount.should.equal(
1
)
this.res.redirect.calledWith('/login').should.equal(true)
})
it('should not render the launchpad page', function() {