Skip to content

Commit

Permalink
Add try statement in middleware for process_request (#3)
Browse files Browse the repository at this point in the history
* Update how middleware handles request

* 2.2.1 release
  • Loading branch information
toryburgett authored Oct 5, 2017
1 parent b07f751 commit 2a84495
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
5 changes: 1 addition & 4 deletions django_cas/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,14 @@ class CASMiddleware(object):
def process_request(self, request):
"""Logs in the user if a ticket is append as parameter"""

ticket = request.REQUEST.get('ticket')
ticket = request.GET.get('ticket')

if ticket:
from django.contrib import auth
user = auth.authenticate(ticket=ticket, service=_service_url(request))
if user is not None:
auth.login(request, user)




def process_view(self, request, view_func, view_args, view_kwargs):
"""Forwards unauthenticated requests to the admin page to the CAS
login URL, as well as calls to django.contrib.auth.views.login and
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@
""",
name='django-cas-hz',
packages=['django_cas'],
url='https://github.com/castlabs/django-cas',
version='2.2.0',
url='https://github.com/hzdg/django-cas',
version='2.2.1',
)

0 comments on commit 2a84495

Please sign in to comment.