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

Fixed Django 1.4 incompatibility #4

Open
wants to merge 2 commits into
base: master
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
6 changes: 3 additions & 3 deletions django_cas/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from datetime import datetime
from urllib import urlencode
from urlparse import urljoin

from django.contrib import messages
from django.http import get_host, HttpResponseRedirect, HttpResponseForbidden, HttpResponse
from django.conf import settings
from django.contrib.auth import REDIRECT_FIELD_NAME
Expand Down Expand Up @@ -74,7 +74,7 @@ def login(request, next_page=None, required=False):
next_page = _redirect_url(request)
if request.user.is_authenticated():
message = "You are logged in as %s." % request.user.username
request.user.message_set.create(message=message)
messages.add_message(request, messages.SUCCESS, message)
return HttpResponseRedirect(next_page)
ticket = request.GET.get('ticket')
service = _service_url(request, next_page)
Expand All @@ -86,7 +86,7 @@ def login(request, next_page=None, required=False):
auth.login(request, user)
name = user.first_name or user.username
message = "Login succeeded. Welcome, %s." % name
user.message_set.create(message=message)
messages.add_message(request, messages.SUCCESS, message)
return HttpResponseRedirect(next_page)
elif settings.CAS_RETRY_LOGIN or required:
return HttpResponseRedirect(_login_url(service, ticket))
Expand Down