Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-cas
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
django-cas
Commits
47cfef16
Commit
47cfef16
authored
Aug 20, 2015
by
Carson Gee
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1 from fmyzjs/patch-1
This fixes issues with Django 1.5. django.http.get_host()
parents
60a5b8e5
b8385969
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
django_cas/views.py
+4
-4
No files found.
django_cas/views.py
View file @
47cfef16
...
@@ -3,7 +3,7 @@ from datetime import datetime
...
@@ -3,7 +3,7 @@ from datetime import datetime
from
urllib
import
urlencode
from
urllib
import
urlencode
from
urlparse
import
urljoin
from
urlparse
import
urljoin
from
django.http
import
get_host
,
HttpResponseRedirect
,
HttpResponseForbidden
,
HttpResponse
from
django.http
import
HttpResponseRedirect
,
HttpResponseForbidden
,
HttpResponse
from
django.conf
import
settings
from
django.conf
import
settings
from
django.contrib
import
messages
from
django.contrib
import
messages
from
django.contrib.auth
import
REDIRECT_FIELD_NAME
from
django.contrib.auth
import
REDIRECT_FIELD_NAME
...
@@ -15,7 +15,7 @@ def _service_url(request, redirect_to=None):
...
@@ -15,7 +15,7 @@ def _service_url(request, redirect_to=None):
"""Generates application service URL for CAS"""
"""Generates application service URL for CAS"""
protocol
=
(
'http://'
,
'https://'
)[
request
.
is_secure
()]
protocol
=
(
'http://'
,
'https://'
)[
request
.
is_secure
()]
host
=
get_host
(
request
)
host
=
request
.
get_host
(
)
service
=
protocol
+
host
+
request
.
path
service
=
protocol
+
host
+
request
.
path
if
redirect_to
:
if
redirect_to
:
if
'?'
in
service
:
if
'?'
in
service
:
...
@@ -38,7 +38,7 @@ def _redirect_url(request):
...
@@ -38,7 +38,7 @@ def _redirect_url(request):
else
:
else
:
next
=
request
.
META
.
get
(
'HTTP_REFERER'
,
settings
.
CAS_REDIRECT_URL
)
next
=
request
.
META
.
get
(
'HTTP_REFERER'
,
settings
.
CAS_REDIRECT_URL
)
prefix
=
((
'http://'
,
'https://'
)[
request
.
is_secure
()]
+
prefix
=
((
'http://'
,
'https://'
)[
request
.
is_secure
()]
+
get_host
(
request
))
request
.
get_host
(
))
if
next
.
startswith
(
prefix
):
if
next
.
startswith
(
prefix
):
next
=
next
[
len
(
prefix
):]
next
=
next
[
len
(
prefix
):]
return
next
return
next
...
@@ -63,7 +63,7 @@ def _logout_url(request, next_page=None):
...
@@ -63,7 +63,7 @@ def _logout_url(request, next_page=None):
url
=
urljoin
(
settings
.
CAS_SERVER_URL
,
'logout'
)
url
=
urljoin
(
settings
.
CAS_SERVER_URL
,
'logout'
)
if
next_page
:
if
next_page
:
protocol
=
(
'http://'
,
'https://'
)[
request
.
is_secure
()]
protocol
=
(
'http://'
,
'https://'
)[
request
.
is_secure
()]
host
=
get_host
(
request
)
host
=
request
.
get_host
(
)
url
+=
'?'
+
urlencode
({
'url'
:
protocol
+
host
+
next_page
})
url
+=
'?'
+
urlencode
({
'url'
:
protocol
+
host
+
next_page
})
return
url
return
url
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment