mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Don't record redirect to static asset paths
This commit is contained in:
parent
82ddeab2bd
commit
1137ab0715
2 changed files with 11 additions and 2 deletions
|
@ -194,8 +194,8 @@ 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?
|
if req.session? && !value.match(new RegExp('^\/(socket.io|js|stylesheets|img)\/.*$'))
|
||||||
req.session.postLoginRedirect = value
|
req.session.postLoginRedirect = value
|
||||||
|
|
||||||
_getRedirectFromSession: (req) ->
|
_getRedirectFromSession: (req) ->
|
||||||
|
|
|
@ -550,6 +550,15 @@ 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 js path', ->
|
||||||
|
|
||||||
|
beforeEach ->
|
||||||
|
@req = {session: {}}
|
||||||
|
|
||||||
|
it 'should not set the redirect', ->
|
||||||
|
@AuthenticationController._setRedirectInSession(@req, '/js/something.js')
|
||||||
|
expect(@req.session.postLoginRedirect).to.equal undefined
|
||||||
|
|
||||||
describe '_getRedirectFromSession', ->
|
describe '_getRedirectFromSession', ->
|
||||||
beforeEach ->
|
beforeEach ->
|
||||||
@req = {session: {postLoginRedirect: "/a?b=c"}}
|
@req = {session: {postLoginRedirect: "/a?b=c"}}
|
||||||
|
|
Loading…
Reference in a new issue