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
66eb47fb
Commit
66eb47fb
authored
Jul 16, 2013
by
ihoover
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disabled csrf and made auto_login page toggleable with setting
parent
978d33ba
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
2 deletions
+37
-2
lms/djangoapps/branding/views.py
+18
-0
lms/envs/common.py
+13
-2
lms/urls.py
+6
-0
No files found.
lms/djangoapps/branding/views.py
View file @
66eb47fb
...
@@ -49,3 +49,21 @@ def courses(request):
...
@@ -49,3 +49,21 @@ def courses(request):
return
courseware
.
views
.
courses
(
request
)
return
courseware
.
views
.
courses
(
request
)
return
courseware
.
views
.
university_profile
(
request
,
university
)
return
courseware
.
views
.
university_profile
(
request
,
university
)
def
auto_auth
(
request
):
"""
Automatically logs the anonymous user in with a generated random credentials
This view is only accessible when settings.AUTOMATIC_AUTH_FOR_LOAD_TESTING is
true.
"""
# log the user in
student
.
views
.
create_account
(
request
)
# activate account
request
.
user
.
is_active
=
True
request
.
user
.
save
()
# redirect to home-page
return
redirect
(
'root'
)
lms/envs/common.py
View file @
66eb47fb
...
@@ -37,9 +37,14 @@ PLATFORM_NAME = "edX"
...
@@ -37,9 +37,14 @@ PLATFORM_NAME = "edX"
COURSEWARE_ENABLED
=
True
COURSEWARE_ENABLED
=
True
ENABLE_JASMINE
=
False
ENABLE_JASMINE
=
False
AUTOMATIC_AUTH_FOR_LOAD_TESTING
=
True
GENERATE_RANDOM_USER_CREDENTIALS
=
False
GENERATE_RANDOM_USER_CREDENTIALS
=
False
PERFSTATS
=
False
PERFSTATS
=
False
# automatic_auth should turn on random_cred of it needs to
GENERATE_RANDOM_USER_CREDENTIALS
=
GENERATE_RANDOM_USER_CREDENTIALS
or
AUTOMATIC_AUTH_FOR_LOAD_TESTING
DISCUSSION_SETTINGS
=
{
DISCUSSION_SETTINGS
=
{
'MAX_COMMENT_DEPTH'
:
2
,
'MAX_COMMENT_DEPTH'
:
2
,
}
}
...
@@ -214,7 +219,6 @@ TEMPLATE_CONTEXT_PROCESSORS = (
...
@@ -214,7 +219,6 @@ TEMPLATE_CONTEXT_PROCESSORS = (
'django.contrib.messages.context_processors.messages'
,
'django.contrib.messages.context_processors.messages'
,
#'django.core.context_processors.i18n',
#'django.core.context_processors.i18n',
'django.contrib.auth.context_processors.auth'
,
# this is required for admin
'django.contrib.auth.context_processors.auth'
,
# this is required for admin
'django.core.context_processors.csrf'
,
# necessary for csrf protection
# Added for django-wiki
# Added for django-wiki
'django.core.context_processors.media'
,
'django.core.context_processors.media'
,
...
@@ -227,6 +231,10 @@ TEMPLATE_CONTEXT_PROCESSORS = (
...
@@ -227,6 +231,10 @@ TEMPLATE_CONTEXT_PROCESSORS = (
'mitxmako.shortcuts.marketing_link_context_processor'
,
'mitxmako.shortcuts.marketing_link_context_processor'
,
)
)
# add csrf support unless disabled for load testing
if
not
AUTOMATIC_AUTH_FOR_LOAD_TESTING
:
TEMPLATE_CONTEXT_PROCESSORS
+=
(
'django.core.context_processors.csrf'
,)
# necessary for csrf protection
STUDENT_FILEUPLOAD_MAX_SIZE
=
4
*
1000
*
1000
# 4 MB
STUDENT_FILEUPLOAD_MAX_SIZE
=
4
*
1000
*
1000
# 4 MB
MAX_FILEUPLOADS_PER_INPUT
=
20
MAX_FILEUPLOADS_PER_INPUT
=
20
...
@@ -463,7 +471,6 @@ MIDDLEWARE_CLASSES = (
...
@@ -463,7 +471,6 @@ MIDDLEWARE_CLASSES = (
'django_comment_client.middleware.AjaxExceptionMiddleware'
,
'django_comment_client.middleware.AjaxExceptionMiddleware'
,
'django.middleware.common.CommonMiddleware'
,
'django.middleware.common.CommonMiddleware'
,
'django.contrib.sessions.middleware.SessionMiddleware'
,
'django.contrib.sessions.middleware.SessionMiddleware'
,
'django.middleware.csrf.CsrfViewMiddleware'
,
# Instead of AuthenticationMiddleware, we use a cached backed version
# Instead of AuthenticationMiddleware, we use a cached backed version
#'django.contrib.auth.middleware.AuthenticationMiddleware',
#'django.contrib.auth.middleware.AuthenticationMiddleware',
...
@@ -482,6 +489,10 @@ MIDDLEWARE_CLASSES = (
...
@@ -482,6 +489,10 @@ MIDDLEWARE_CLASSES = (
'codejail.django_integration.ConfigureCodeJailMiddleware'
,
'codejail.django_integration.ConfigureCodeJailMiddleware'
,
)
)
# add in csrf middleware unless disabled for load testing
if
not
AUTOMATIC_AUTH_FOR_LOAD_TESTING
:
MIDDLEWARE_CLASSES
=
MIDDLEWARE_CLASSES
+
(
'django.middleware.csrf.CsrfViewMiddleware'
,)
############################### Pipeline #######################################
############################### Pipeline #######################################
STATICFILES_STORAGE
=
'pipeline.storage.PipelineCachedStorage'
STATICFILES_STORAGE
=
'pipeline.storage.PipelineCachedStorage'
...
...
lms/urls.py
View file @
66eb47fb
...
@@ -439,6 +439,12 @@ urlpatterns = patterns(*urlpatterns)
...
@@ -439,6 +439,12 @@ urlpatterns = patterns(*urlpatterns)
if
settings
.
DEBUG
:
if
settings
.
DEBUG
:
urlpatterns
+=
static
(
settings
.
STATIC_URL
,
document_root
=
settings
.
STATIC_ROOT
)
urlpatterns
+=
static
(
settings
.
STATIC_URL
,
document_root
=
settings
.
STATIC_ROOT
)
# enable automatic login
if
settings
.
AUTOMATIC_AUTH_FOR_LOAD_TESTING
:
urlpatterns
+=
(
url
(
r'^auto_auth$'
,
'branding.views.auto_auth'
),
)
#Custom error pages
#Custom error pages
handler404
=
'static_template_view.views.render_404'
handler404
=
'static_template_view.views.render_404'
handler500
=
'static_template_view.views.render_500'
handler500
=
'static_template_view.views.render_500'
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