mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Don't redirect to images, icons, etc, in login workflow
This commit is contained in:
parent
d550ede112
commit
0e26222551
2 changed files with 13 additions and 1 deletions
|
@ -196,7 +196,11 @@ module.exports = AuthenticationController =
|
||||||
_setRedirectInSession: (req, value) ->
|
_setRedirectInSession: (req, value) ->
|
||||||
if !value?
|
if !value?
|
||||||
value = if Object.keys(req.query).length > 0 then "#{req.path}?#{querystring.stringify(req.query)}" else "#{req.path}"
|
value = if Object.keys(req.query).length > 0 then "#{req.path}?#{querystring.stringify(req.query)}" else "#{req.path}"
|
||||||
if req.session? && !value.match(new RegExp('^\/(socket.io|js|stylesheets|img)\/.*$'))
|
if (
|
||||||
|
req.session? &&
|
||||||
|
!value.match(new RegExp('^\/(socket.io|js|stylesheets|img)\/.*$')) &&
|
||||||
|
!value.match(new RegExp('^.*\.(png|jpeg|svg)$'))
|
||||||
|
)
|
||||||
req.session.postLoginRedirect = value
|
req.session.postLoginRedirect = value
|
||||||
|
|
||||||
_getRedirectFromSession: (req) ->
|
_getRedirectFromSession: (req) ->
|
||||||
|
|
|
@ -555,6 +555,14 @@ describe "AuthenticationController", ->
|
||||||
@AuthenticationController._setRedirectInSession(@req, '/somewhere/specific')
|
@AuthenticationController._setRedirectInSession(@req, '/somewhere/specific')
|
||||||
expect(@req.session.postLoginRedirect).to.equal "/somewhere/specific"
|
expect(@req.session.postLoginRedirect).to.equal "/somewhere/specific"
|
||||||
|
|
||||||
|
describe 'with a png', ->
|
||||||
|
beforeEach ->
|
||||||
|
@req = {session: {}}
|
||||||
|
|
||||||
|
it 'should not set the redirect', ->
|
||||||
|
@AuthenticationController._setRedirectInSession(@req, '/something.png')
|
||||||
|
expect(@req.session.postLoginRedirect).to.equal undefined
|
||||||
|
|
||||||
describe 'with a js path', ->
|
describe 'with a js path', ->
|
||||||
|
|
||||||
beforeEach ->
|
beforeEach ->
|
||||||
|
|
Loading…
Reference in a new issue