X-Git-Url: https://git.mdrn.pl/django-cas-provider.git/blobdiff_plain/2e6b29407ab1eabe814f664663c1f3dd1b523f82..cdc7ab05f77d2866dd8c42bc16e900cb0e2908d5:/cas_provider/views.py diff --git a/cas_provider/views.py b/cas_provider/views.py index b67635d..2979d1b 100644 --- a/cas_provider/views.py +++ b/cas_provider/views.py @@ -35,7 +35,7 @@ def login(request, template_name='cas/login.html', success_redirect='/account/', else: url = service + '&ticket=' + ticket.ticket logging.debug('Redirecting to %s', url) - return HttpResponseRedirect() + return HttpResponseRedirect(url) else: logging.debug('Redirecting to %s', success_redirect) return HttpResponseRedirect(success_redirect) @@ -136,15 +136,18 @@ def validate(request): ticket = ServiceTicket.objects.get(ticket=ticket_string) except ServiceTicket.DoesNotExist: logger.exception("Tried to validate with an invalid ticket %s for %s", ticket_string, service) + except Exception as e: + logger.exception('Got an exception: %s', e) else: username = ticket.user.username ticket.delete() results = signals.on_cas_collect_histories.send(sender=validate, for_email=ticket.user.email) histories = '\n'.join('\n'.join(rs) for rc, rs in results) - + logger.info('Validated %s %s', username, "(also %s)" % histories if histories else '') return HttpResponse("yes\n%s\n%s" % (username, histories)) + logger.info('Validation failed.') return HttpResponse("no\n\n")