Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
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
edx
edx-platform
Commits
e868759c
Commit
e868759c
authored
Aug 12, 2013
by
ichuang
Committed by
Carson Gee
Dec 12, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix external_auth @ssl_login_shortcut decorator to properly use retfun
parent
74b3a8ab
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
4 deletions
+16
-4
common/djangoapps/external_auth/views.py
+16
-4
No files found.
common/djangoapps/external_auth/views.py
View file @
e868759c
...
@@ -180,7 +180,7 @@ def _external_login_or_signup(request,
...
@@ -180,7 +180,7 @@ def _external_login_or_signup(request,
return
_signup
(
request
,
eamap
)
return
_signup
(
request
,
eamap
)
else
:
else
:
log
.
info
(
'No user for
%
s yet. doing signup'
,
eamap
.
external_email
)
log
.
info
(
'No user for
%
s yet. doing signup'
,
eamap
.
external_email
)
return
_signup
(
request
,
eamap
)
return
_signup
(
request
,
eamap
,
retfun
)
# We trust shib's authentication, so no need to authenticate using the password again
# We trust shib's authentication, so no need to authenticate using the password again
uname
=
internal_user
.
username
uname
=
internal_user
.
username
...
@@ -198,7 +198,7 @@ def _external_login_or_signup(request,
...
@@ -198,7 +198,7 @@ def _external_login_or_signup(request,
if
user
is
None
:
if
user
is
None
:
# we want to log the failure, but don't want to log the password attempted:
# we want to log the failure, but don't want to log the password attempted:
AUDIT_LOG
.
warning
(
'External Auth Login failed for "
%
s"'
,
uname
)
AUDIT_LOG
.
warning
(
'External Auth Login failed for "
%
s"'
,
uname
)
return
_signup
(
request
,
eamap
)
return
_signup
(
request
,
eamap
,
retfun
)
if
not
user
.
is_active
:
if
not
user
.
is_active
:
AUDIT_LOG
.
warning
(
'User "
%
s" is not active after external login'
,
uname
)
AUDIT_LOG
.
warning
(
'User "
%
s" is not active after external login'
,
uname
)
...
@@ -237,7 +237,8 @@ def _flatten_to_ascii(txt):
...
@@ -237,7 +237,8 @@ def _flatten_to_ascii(txt):
@ensure_csrf_cookie
@ensure_csrf_cookie
def
_signup
(
request
,
eamap
):
@cache_if_anonymous
def
_signup
(
request
,
eamap
,
retfun
=
None
):
"""
"""
Present form to complete for signup via external authentication.
Present form to complete for signup via external authentication.
Even though the user has external credentials, he/she still needs
Even though the user has external credentials, he/she still needs
...
@@ -246,6 +247,9 @@ def _signup(request, eamap):
...
@@ -246,6 +247,9 @@ def _signup(request, eamap):
eamap is an ExternalAuthMap object, specifying the external user
eamap is an ExternalAuthMap object, specifying the external user
for which to complete the signup.
for which to complete the signup.
retfun is a function to execute for the return value, if immediate
signup is used. That allows @ssl_login_shortcut() to work.
"""
"""
# save this for use by student.views.create_account
# save this for use by student.views.create_account
request
.
session
[
'ExternalAuthMap'
]
=
eamap
request
.
session
[
'ExternalAuthMap'
]
=
eamap
...
@@ -352,10 +356,17 @@ def ssl_login_shortcut(fn):
...
@@ -352,10 +356,17 @@ def ssl_login_shortcut(fn):
if
not
settings
.
FEATURES
[
'AUTH_USE_MIT_CERTIFICATES'
]:
if
not
settings
.
FEATURES
[
'AUTH_USE_MIT_CERTIFICATES'
]:
return
fn
(
*
args
,
**
kwargs
)
return
fn
(
*
args
,
**
kwargs
)
request
=
args
[
0
]
request
=
args
[
0
]
if
request
.
user
and
request
.
user
.
is_authenticated
():
# don't re-authenticate
return
fn
(
*
args
,
**
kwargs
)
cert
=
_ssl_get_cert_from_request
(
request
)
cert
=
_ssl_get_cert_from_request
(
request
)
if
not
cert
:
# no certificate information - show normal login window
if
not
cert
:
# no certificate information - show normal login window
return
fn
(
*
args
,
**
kwargs
)
return
fn
(
*
args
,
**
kwargs
)
def
retfun
():
return
fn
(
*
args
,
**
kwargs
)
(
_user
,
email
,
fullname
)
=
_ssl_dn_extract_info
(
cert
)
(
_user
,
email
,
fullname
)
=
_ssl_dn_extract_info
(
cert
)
return
_external_login_or_signup
(
return
_external_login_or_signup
(
request
,
request
,
...
@@ -363,7 +374,8 @@ def ssl_login_shortcut(fn):
...
@@ -363,7 +374,8 @@ def ssl_login_shortcut(fn):
external_domain
=
"ssl:MIT"
,
external_domain
=
"ssl:MIT"
,
credentials
=
cert
,
credentials
=
cert
,
email
=
email
,
email
=
email
,
fullname
=
fullname
fullname
=
fullname
,
retfun
=
retfun
)
)
return
wrapped
return
wrapped
...
...
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