views: fix undefined user variable

If negoration needs more than one round-trip, the user variable is
undefined.
This commit is contained in:
Benjamin Dauvergne 2022-01-13 00:05:11 +01:00
parent 701102f336
commit 5ed0b40379
1 changed files with 4 additions and 3 deletions

View File

@ -82,12 +82,13 @@ class LoginView(View):
store=self.get_gssapi_store())
except utils.NegotiateContinue as e:
token = e.token
user = None
if user is None:
response = self.challenge()
else:
if user is not None:
logger.debug('GSSAPI found user %s for name %s', user, gss_name)
response = self.success(user)
else:
response = self.challenge()
utils.response_add_www_authenticate(response, token)
return response