Return username in CAS1.0 on the second ligne
This commit is contained in:
parent
80b16c002b
commit
b0e8d0ee05
1 changed files with 15 additions and 1 deletions
|
@ -563,7 +563,21 @@ class Validate(View):
|
|||
ticket.service
|
||||
)
|
||||
)
|
||||
return HttpResponse("yes\n", content_type="text/plain")
|
||||
if (ticket.service_pattern.user_field and
|
||||
ticket.user.attributs.get(ticket.service_pattern.user_field)):
|
||||
username = ticket.user.attributs.get(
|
||||
ticket.service_pattern.user_field
|
||||
)
|
||||
if isinstance(username, list):
|
||||
try:
|
||||
username = username[0]
|
||||
except IndexError:
|
||||
username = None
|
||||
if not username:
|
||||
username = ""
|
||||
else:
|
||||
username = ticket.user.username
|
||||
return HttpResponse("yes\n%s\n" % username, content_type="text/plain")
|
||||
except ServiceTicket.DoesNotExist:
|
||||
logger.warning(
|
||||
(
|
||||
|
|
Loading…
Reference in a new issue