Fix v1 return to path

This commit is contained in:
Alasdair Smith 2018-09-25 10:06:24 +01:00
parent da16e8d01f
commit 298ee2dbb4
3 changed files with 3 additions and 3 deletions

View file

@ -37,7 +37,7 @@ module.exports = TokenAccessController =
if !projectExists and settings.overleaf
logger.log {token, userId},
"[TokenAccess] no project found for this token"
return res.redirect(302, "/sign_in_to_v1?return_to=#{settings.overleaf.host}/#{token}")
return res.redirect(302, "/sign_in_to_v1?return_to=/#{token}")
if !project?
logger.log {token, userId},
"[TokenAccess] no token-based project found for readAndWrite token"

View file

@ -422,7 +422,7 @@ describe 'TokenAccess', ->
try_read_and_write_token_access(@owner, unimportedV1Token, (response, body) =>
expect(response.statusCode).to.equal 302
expect(response.headers.location).to.equal(
'/sign_in_to_v1?return_to=http://overleaf.test:5000/123abc'
'/sign_in_to_v1?return_to=/123abc'
)
, done)

View file

@ -254,7 +254,7 @@ describe "TokenAccessController", ->
expect(@res.redirect.callCount).to.equal 1
expect(@res.redirect.calledWith(
302,
'/sign_in_to_v1?return_to=http://overleaf.test:5000/123abc'
'/sign_in_to_v1?return_to=/123abc'
)).to.equal true
done()