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
1c70294e
Commit
1c70294e
authored
Nov 25, 2009
by
Brodie Rao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor refactoring
parent
e0d8876b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
9 deletions
+6
-9
django_cas/middleware.py
+1
-2
django_cas/views.py
+5
-7
No files found.
django_cas/middleware.py
View file @
1c70294e
...
...
@@ -49,5 +49,4 @@ class CASMiddleware(object):
'privileges.</p>'
)
return
HttpResponseForbidden
(
error
)
params
=
urlencode
({
REDIRECT_FIELD_NAME
:
request
.
get_full_path
()})
url
=
reverse
(
cas_login
)
return
HttpResponseRedirect
(
url
+
'?'
+
params
)
return
HttpResponseRedirect
(
reverse
(
cas_login
)
+
'?'
+
params
)
django_cas/views.py
View file @
1c70294e
...
...
@@ -48,8 +48,7 @@ def _login_url(service):
params
=
{
'service'
:
service
}
if
settings
.
CAS_EXTRA_LOGIN_PARAMS
:
params
.
update
(
settings
.
CAS_EXTRA_LOGIN_PARAMS
)
url
=
urljoin
(
settings
.
CAS_SERVER_URL
,
'login'
)
+
'?'
+
urlencode
(
params
)
return
url
return
urljoin
(
settings
.
CAS_SERVER_URL
,
'login'
)
+
'?'
+
urlencode
(
params
)
def
_logout_url
(
request
,
next_page
=
None
):
...
...
@@ -75,10 +74,10 @@ def login(request, next_page=None):
ticket
=
request
.
GET
.
get
(
'ticket'
)
service
=
_service_url
(
request
,
next_page
)
if
ticket
:
from
django.contrib
.auth
import
authenticate
,
login
user
=
authenticate
(
ticket
=
ticket
,
service
=
service
)
from
django.contrib
import
auth
user
=
auth
.
auth
enticate
(
ticket
=
ticket
,
service
=
service
)
if
user
is
not
None
:
login
(
request
,
user
)
auth
.
login
(
request
,
user
)
name
=
user
.
first_name
or
user
.
username
message
=
"Login succeeded. Welcome,
%
s."
%
name
user
.
message_set
.
create
(
message
=
message
)
...
...
@@ -87,8 +86,7 @@ def login(request, next_page=None):
error
=
"<h1>Forbidden</h1><p>Login failed.</p>"
return
HttpResponseForbidden
(
error
)
else
:
url
=
_login_url
(
service
)
return
HttpResponseRedirect
(
url
)
return
HttpResponseRedirect
(
_login_url
(
service
))
def
logout
(
request
,
next_page
=
None
):
...
...
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