Skip to content

Commit

Permalink
Fix and close gae-init#709 (gae-init#710)
Browse files Browse the repository at this point in the history
  • Loading branch information
gmist authored and lipis committed Aug 28, 2017
1 parent cf9bdcc commit 8ebeffd
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions main/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ def switch(case):


def is_trusted_url(next_url):
if not next_url:
return ''
next_url_host = urlparse(next_url).hostname
if config.TRUSTED_HOSTS and next_url_host not in config.TRUSTED_HOSTS:
return flask.url_for('welcome')
Expand All @@ -50,10 +52,10 @@ def get_next_url(next_url=''):
'next': wf.Str(missing=None), 'next_url': wf.Str(missing=None)
})
next_url = next_url or args['next'] or args['next_url']
do_not_redirect_urls = [flask.url_for(u) for u in [
'signin', 'signup', 'user_forgot', 'user_reset',
]]
if next_url:
do_not_redirect_urls = [flask.url_for(u) for u in [
'signin', 'signup', 'user_forgot', 'user_reset',
]]
if any(url in next_url for url in do_not_redirect_urls):
return flask.url_for('welcome')
return is_trusted_url(next_url)
Expand Down

0 comments on commit 8ebeffd

Please sign in to comment.