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
874c6314
Commit
874c6314
authored
11 years ago
by
Diana Huang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow users who are not logged in to register.
parent
15b23a16
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
14 deletions
+28
-14
common/djangoapps/course_modes/views.py
+7
-5
common/djangoapps/student/views.py
+12
-7
lms/templates/login.html
+3
-1
lms/templates/register.html
+6
-1
No files found.
common/djangoapps/course_modes/views.py
View file @
874c6314
...
...
@@ -6,6 +6,8 @@ from django.shortcuts import redirect
from
django.views.generic.base
import
View
from
django.utils.translation
import
ugettext
as
_
from
django.utils.http
import
urlencode
from
django.contrib.auth.decorators
import
login_required
from
django.utils.decorators
import
method_decorator
from
mitxmako.shortcuts
import
render_to_response
...
...
@@ -16,12 +18,13 @@ from student.views import course_from_id
class
ChooseModeView
(
View
):
@method_decorator
(
login_required
)
def
get
(
self
,
request
):
course_id
=
request
.
GET
.
get
(
"course_id"
)
context
=
{
"course_id"
:
course_id
,
"modes"
:
CourseMode
.
modes_for_course_dict
(
course_id
),
"course_name"
:
course_from_id
(
course_id
)
.
display_name
"course_id"
:
course_id
,
"modes"
:
CourseMode
.
modes_for_course_dict
(
course_id
),
"course_name"
:
course_from_id
(
course_id
)
.
display_name
}
return
render_to_response
(
"course_modes/choose.html"
,
context
)
...
...
@@ -67,4 +70,4 @@ class ChooseModeView(View):
"Select Audit"
:
"audit"
,
"Select Certificate"
:
"verified"
}
return
choices
.
get
(
user_choice
)
\ No newline at end of file
return
choices
.
get
(
user_choice
)
This diff is collapsed.
Click to expand it.
common/djangoapps/student/views.py
View file @
874c6314
...
...
@@ -325,10 +325,12 @@ def try_change_enrollment(request):
enrollment_response
.
content
)
)
if
enrollment_response
.
content
!=
''
:
return
enrollment_response
.
content
except
Exception
,
e
:
log
.
exception
(
"Exception automatically enrolling after login: {0}"
.
format
(
str
(
e
)))
@login_required
@require_POST
def
change_enrollment
(
request
):
"""
...
...
@@ -354,6 +356,9 @@ def change_enrollment(request):
if
course_id
is
None
:
return
HttpResponseBadRequest
(
_
(
"Course id not specified"
))
if
not
user
.
is_authenticated
():
return
HttpResponseForbidden
()
if
action
==
"enroll"
:
# Make sure the course exists
# We don't do this check on unenroll, or a bad course id can't be unenrolled from
...
...
@@ -458,10 +463,10 @@ def login_user(request, error=""):
log
.
exception
(
e
)
raise
try_change_enrollment
(
request
)
redirect_url
=
try_change_enrollment
(
request
)
statsd
.
increment
(
"common.student.successful_login"
)
response
=
HttpResponse
(
json
.
dumps
({
'success'
:
True
}))
response
=
HttpResponse
(
json
.
dumps
({
'success'
:
True
,
'redirect_url'
:
redirect_url
}))
# set the login cookie for the edx marketing site
# we want this cookie to be accessed via javascript
...
...
@@ -724,14 +729,14 @@ def create_account(request, post_override=None):
login_user
.
save
()
AUDIT_LOG
.
info
(
u"Login activated on extauth account - {0} ({1})"
.
format
(
login_user
.
username
,
login_user
.
email
))
try_change_enrollment
(
request
)
redirect_url
=
try_change_enrollment
(
request
)
statsd
.
increment
(
"common.student.account_created"
)
js
=
{
'success'
:
True
}
HttpResponse
(
json
.
dumps
(
js
),
mimetype
=
"application/json"
)
response_params
=
{
'success'
:
True
,
'redirect_url'
:
redirect_url
}
response
=
HttpResponse
(
json
.
dumps
(
{
'success'
:
True
}
))
response
=
HttpResponse
(
json
.
dumps
(
response_params
))
# set the login cookie for the edx marketing site
# we want this cookie to be accessed via javascript
...
...
This diff is collapsed.
Click to expand it.
lms/templates/login.html
View file @
874c6314
...
...
@@ -50,7 +50,9 @@
next
=
u
.
split
(
"next="
)[
1
];
if
(
next
&&
!
isExternal
(
next
))
{
location
.
href
=
next
;
}
else
{
}
else
if
(
json
.
redirect_url
){
location
.
href
=
json
.
redirect_url
;
}
else
{
location
.
href
=
"${reverse('dashboard')}"
;
}
}
else
{
...
...
This diff is collapsed.
Click to expand it.
lms/templates/register.html
View file @
874c6314
...
...
@@ -53,7 +53,12 @@
$
(
'#register-form'
).
on
(
'ajax:success'
,
function
(
event
,
json
,
xhr
)
{
if
(
json
.
success
)
{
location
.
href
=
"${reverse('dashboard')}"
;
if
(
json
.
redirect_url
){
location
.
href
=
json
.
redirect_url
;
}
else
{
location
.
href
=
"${reverse('dashboard')}"
;
}
}
else
{
toggleSubmitButton
(
true
);
$
(
'.status.message.submission-error'
).
addClass
(
'is-shown'
).
focus
();
...
...
This diff is collapsed.
Click to expand it.
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