Skip to content

Commit 3d5646a

Browse files
committed
indentation fixed
1 parent b94da1e commit 3d5646a

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

djangosaml2/views.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -147,18 +147,17 @@ def login(request,
147147

148148
# Do we have a Discovery Service?
149149
discovery_service = getattr(settings, 'SAML2_DISCO_URL', False)
150-
if discovery_service:
151-
if not selected_idp and discovery_service:
152-
# We have to build the URL to redirect to with all the information
153-
# for the Discovery Service to know how to send the flow back to us
154-
login_url = request.build_absolute_uri(reverse('saml2_login'))
155-
login_url = '{0}?next={1}'.format(login_url,
156-
urlquote(came_from, safe=''))
157-
ds_url = '{0}?entityID={1}&return={2}&returnIDParam=idp'
158-
ds_url = ds_url.format(discovery_service,
159-
urlquote(getattr(conf,'entityid'), safe=''),
160-
urlquote(login_url, safe=''))
161-
return HttpResponseRedirect(ds_url)
150+
if discovery_service and not selected_idp:
151+
# We have to build the URL to redirect to with all the information
152+
# for the Discovery Service to know how to send the flow back to us
153+
login_url = request.build_absolute_uri(reverse('saml2_login'))
154+
login_url = '{0}?next={1}'.format(login_url,
155+
urlquote(came_from, safe=''))
156+
ds_url = '{0}?entityID={1}&return={2}&returnIDParam=idp'
157+
ds_url = ds_url.format(discovery_service,
158+
urlquote(getattr(conf,'entityid'), safe=''),
159+
urlquote(login_url, safe=''))
160+
return HttpResponseRedirect(ds_url)
162161

163162
# is a embedded wayf needed?
164163
idps = available_idps(conf)

0 commit comments

Comments
 (0)