next_url = r.session.get('login_next_url', settings.SAML2_AUTH.get('DEFAULT_NEXT_URL', get_reverse('admin:index')))
The problem is if admin:index is not defined, the exception happens regardless of whether DEFAULT_NEXT_URL is defined.
I think this is best done as an if statement so we only trigger the exception if DEFAULT_NEXT_URL is not defined,
def _get_default_next_url(saml2_auth: dict) -> str:
next_url = settings.SAML2_AUTH.get('DEFAULT_NEXT_URL', None)
if next_url is not None:
return next_url
return get_reverse('admin:index'))
There's a lot of these sprinkled in the code:
next_url = r.session.get('login_next_url', settings.SAML2_AUTH.get('DEFAULT_NEXT_URL', get_reverse('admin:index')))
The problem is ifadmin:index
is not defined, the exception happens regardless of whetherDEFAULT_NEXT_URL
is defined.I think this is best done as an if statement so we only trigger the exception if
DEFAULT_NEXT_URL
is not defined,