misc: style (#41949)

This commit is contained in:
Benjamin Dauvergne 2020-04-24 13:08:09 +02:00
parent 482aa09f92
commit 24f96bb6c9
2 changed files with 17 additions and 15 deletions

View File

@ -374,8 +374,9 @@ class DefaultAdapter(object):
continue continue
values = saml_attributes.get(saml_attribute) values = saml_attributes.get(saml_attribute)
if not values: if not values:
logger.warning('looking for user by saml attribute %r and user field %r, skipping because empty', logger.warning(
saml_attribute, user_field) 'looking for user by saml attribute %r and user field %r, skipping because empty',
saml_attribute, user_field)
continue continue
ignore_case = line.get('ignore-case', False) ignore_case = line.get('ignore-case', False)
for value in values: for value in values:

View File

@ -202,16 +202,17 @@ class LoginView(ProfileMixin, LogMixin, View):
if error_url: if error_url:
error_url = resolve_url(error_url) error_url = resolve_url(error_url)
next_url = error_url or self.get_next_url(default=resolve_url(settings.LOGIN_REDIRECT_URL)) next_url = error_url or self.get_next_url(default=resolve_url(settings.LOGIN_REDIRECT_URL))
return self.render(request, 'mellon/authentication_failed.html', return self.render(
{ request, 'mellon/authentication_failed.html',
'debug': settings.DEBUG, {
'reason': reason, 'debug': settings.DEBUG,
'status_codes': status_codes, 'reason': reason,
'issuer': login.remoteProviderId, 'status_codes': status_codes,
'next_url': next_url, 'issuer': login.remoteProviderId,
'relaystate': login.msgRelayState, 'next_url': next_url,
'error_redirect_after_timeout': error_redirect_after_timeout, 'relaystate': login.msgRelayState,
}) 'error_redirect_after_timeout': error_redirect_after_timeout,
})
def get_attribute_value(self, attribute, attribute_value): def get_attribute_value(self, attribute, attribute_value):
# check attribute_value contains only text # check attribute_value contains only text
@ -289,9 +290,9 @@ class LoginView(ProfileMixin, LogMixin, View):
'saml_attributes': attributes}) 'saml_attributes': attributes})
else: else:
self.log.warning('no user found for NameID %r', attributes['name_id_content']) self.log.warning('no user found for NameID %r', attributes['name_id_content'])
return self.render(request, 'mellon/user_not_found.html', { return self.render(
'saml_attributes': attributes request, 'mellon/user_not_found.html',
}) {'saml_attributes': attributes})
request.session['lasso_session_dump'] = login.session.dump() request.session['lasso_session_dump'] = login.session.dump()
return HttpResponseRedirect(next_url) return HttpResponseRedirect(next_url)