views: render debug login template at the last moment (#58906)

This commit is contained in:
Valentin Deniaud 2021-11-23 14:41:01 +01:00
parent b80bc26d73
commit 50cb52b160
1 changed files with 3 additions and 4 deletions

View File

@ -289,6 +289,8 @@ class LoginView(ProfileMixin, LogMixin, View):
self.log.debug('trying to authenticate with attributes %r', attributes)
response = self.authenticate(request, login, attributes)
response.delete_cookie(RETRY_LOGIN_COOKIE)
if self.debug_login:
return self.render_debug_template(request, login, attributes)
return response
def authenticate(self, request, login, attributes):
@ -311,10 +313,7 @@ class LoginView(ProfileMixin, LogMixin, View):
return self.render(request, 'mellon/user_not_found.html', {'saml_attributes': attributes})
request.session['lasso_session_dump'] = login.session.dump()
if self.debug_login:
return self.render_debug_template(request, login, attributes)
else:
return HttpResponseRedirect(next_url)
return HttpResponseRedirect(next_url)
def render_debug_template(self, request, login, attributes):
request.session['mellon_debug_login'] = False