X-Git-Url: https://git.mdrn.pl/django-cas-provider.git/blobdiff_plain/730895aa3ce52318f816e4d9146595b96fdeeeb4..8c0324bfebcfa820c2f8d0955430cddedaa23e8a:/cas_provider/views.py?ds=sidebyside
diff --git a/cas_provider/views.py b/cas_provider/views.py
index cdd5d7b..0483a32 100644
--- a/cas_provider/views.py
+++ b/cas_provider/views.py
@@ -6,7 +6,7 @@ from django.contrib.auth import authenticate
from django.contrib.auth import login as auth_login, logout as auth_logout
from cas_provider.forms import LoginForm
-from cas_provider.models import ServiceTicket, LoginTicket
+from cas_provider.models import ServiceTicket, LoginTicket, auth_success_response
from cas_provider.utils import create_service_ticket
__all__ = ['login', 'validate', 'service_validate', 'logout']
@@ -76,15 +76,10 @@ def service_validate(request):
try:
ticket = ServiceTicket.objects.get(ticket=ticket_string)
- username = ticket.user.username
ticket.delete()
- return HttpResponse('''
-
- %(username)s
-
- ''' % {'username': username}, mimetype='text/xml')
+ return HttpResponse(auth_success_response(ticket.user), mimetype='text/xml')
except ServiceTicket.DoesNotExist:
- return HttpResponse(''''
+ return HttpResponse('''
The provided ticket is invalid.