don't crash on calls missing a next_url info

This commit is contained in:
Frédéric Péters 2018-02-12 14:31:54 +01:00
parent 35851aba47
commit 3622d54cf2
1 changed files with 2 additions and 0 deletions

View File

@ -35,6 +35,8 @@ def is_coming_for(request):
'{urn:oasis:names:tc:SAML:2.0:protocol}Extensions/{https://www.entrouvert.com/}next_url')[0].text
except (KeyError, IndexError):
return 'unknown'
if not next_url:
return 'unknown'
target_path = urlparse.urlparse(next_url).path
for prefix in ('manage', 'admin', 'backoffice'):
if target_path.startswith('/%s/' % prefix):