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
e10614e7
Commit
e10614e7
authored
Jan 20, 2015
by
Mark Sadecki
Committed by
Christine Lytwynec
Dec 04, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adds support to auth_auth for redirecting
parent
44eaca08
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
1 deletions
+11
-1
common/djangoapps/student/views.py
+11
-1
No files found.
common/djangoapps/student/views.py
View file @
e10614e7
...
@@ -1799,6 +1799,7 @@ def auto_auth(request):
...
@@ -1799,6 +1799,7 @@ def auto_auth(request):
* `course_id`: Enroll the student in the course with `course_id`
* `course_id`: Enroll the student in the course with `course_id`
* `roles`: Comma-separated list of roles to grant the student in the course with `course_id`
* `roles`: Comma-separated list of roles to grant the student in the course with `course_id`
* `no_login`: Define this to create the user but not login
* `no_login`: Define this to create the user but not login
* `redirect`: Set to "true" will redirect to course if course_id is defined, otherwise it will redirect to dashboard
If username, email, or password are not provided, use
If username, email, or password are not provided, use
randomly generated credentials.
randomly generated credentials.
...
@@ -1823,6 +1824,7 @@ def auto_auth(request):
...
@@ -1823,6 +1824,7 @@ def auto_auth(request):
if
course_id
:
if
course_id
:
course_key
=
CourseLocator
.
from_string
(
course_id
)
course_key
=
CourseLocator
.
from_string
(
course_id
)
role_names
=
[
v
.
strip
()
for
v
in
request
.
GET
.
get
(
'roles'
,
''
)
.
split
(
','
)
if
v
.
strip
()]
role_names
=
[
v
.
strip
()
for
v
in
request
.
GET
.
get
(
'roles'
,
''
)
.
split
(
','
)
if
v
.
strip
()]
redirect_when_done
=
request
.
GET
.
get
(
'redirect'
,
None
)
login_when_done
=
'no_login'
not
in
request
.
GET
login_when_done
=
'no_login'
not
in
request
.
GET
form
=
AccountCreationForm
(
form
=
AccountCreationForm
(
...
@@ -1885,7 +1887,15 @@ def auto_auth(request):
...
@@ -1885,7 +1887,15 @@ def auto_auth(request):
create_comments_service_user
(
user
)
create_comments_service_user
(
user
)
# Provide the user with a valid CSRF token
# Provide the user with a valid CSRF token
# then return a 200 response
# then return a 200 response unless redirect is true
if
redirect_when_done
:
# Redirect to course info page if course_id is known
if
course_id
:
return
redirect
(
reverse
(
'info'
,
kwargs
=
{
'course_id'
:
unicode
(
course_id
)}))
# Otherwise redirect to dashboard
else
:
return
redirect
(
reverse
(
'dashboard'
))
if
request
.
META
.
get
(
'HTTP_ACCEPT'
)
==
'application/json'
:
if
request
.
META
.
get
(
'HTTP_ACCEPT'
)
==
'application/json'
:
response
=
JsonResponse
({
response
=
JsonResponse
({
'created_status'
:
u"Logged in"
if
login_when_done
else
"Created"
,
'created_status'
:
u"Logged in"
if
login_when_done
else
"Created"
,
...
...
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