Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove redundant code #83

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 3 additions & 13 deletions cas/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,7 @@ def login(request, next_page=None, required=False, gateway=False):
return HttpResponseRedirect(next_page)

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

if gateway:
service = _service_url(request, next_page, True)
else:
service = _service_url(request, next_page, False)
service = _service_url(request, next_page, gateway)

if ticket:
user = auth.authenticate(ticket=ticket, service=service)
Expand All @@ -198,10 +194,7 @@ def login(request, next_page=None, required=False, gateway=False):

return HttpResponseRedirect(next_page)
elif settings.CAS_RETRY_LOGIN or required:
if gateway:
return HttpResponseRedirect(_login_url(service, ticket, True))
else:
return HttpResponseRedirect(_login_url(service, ticket, False))
return HttpResponseRedirect(_login_url(service, ticket, gateway))
else:
logger.warning('User has a valid ticket but not a valid session')
# Has ticket, not session
Expand All @@ -216,10 +209,7 @@ def login(request, next_page=None, required=False, gateway=False):
error = "<h1>Forbidden</h1><p>Login failed.</p>"
return HttpResponseForbidden(error)
else:
if gateway:
return HttpResponseRedirect(_login_url(service, ticket, True))
else:
return HttpResponseRedirect(_login_url(service, ticket, False))
return HttpResponseRedirect(_login_url(service, ticket, gateway))


def logout(request, next_page=None):
Expand Down