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
e5f44165
Commit
e5f44165
authored
Jul 16, 2013
by
ihoover
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made activation flag and ENV_TOKEN
parent
9eb1cce3
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
10 deletions
+15
-10
common/djangoapps/student/views.py
+1
-1
lms/djangoapps/branding/views.py
+4
-4
lms/envs/aws.py
+2
-0
lms/envs/common.py
+7
-4
lms/urls.py
+1
-1
No files found.
common/djangoapps/student/views.py
View file @
e5f44165
...
...
@@ -952,7 +952,7 @@ def create_random_account_with_name_and_password(create_account_function):
# for load testing we want to create lots of accounts
# with controlled username and password
if
settings
.
AUTOMATIC_AUTH_FOR_LOAD_TESTING
:
if
settings
.
MITX_FEATURES
.
get
(
'AUTOMATIC_AUTH_FOR_LOAD_TESTING'
)
:
create_account
=
create_random_account_with_name_and_password
(
create_account
)
@ensure_csrf_cookie
...
...
lms/djangoapps/branding/views.py
View file @
e5f44165
...
...
@@ -53,7 +53,7 @@ def courses(request):
def
auto_auth
(
request
):
"""
Automatically logs the
anonymous
user in with a generated random credentials
Automatically logs the user in with a generated random credentials
This view is only accessible when settings.AUTOMATIC_AUTH_FOR_LOAD_TESTING is
true.
"""
...
...
@@ -62,7 +62,7 @@ def auto_auth(request):
from
django.contrib.auth
import
login
,
authenticate
from
random
import
randint
# generate random user ceredentials from a small name space
# generate random user ceredentials from a small name space
(determined by settings)
name_base
=
'USER_'
pass_base
=
'PASS_'
...
...
@@ -71,14 +71,14 @@ def auto_auth(request):
username
=
name_base
+
str
(
number
)
password
=
pass_base
+
str
(
number
)
# if they already are a user, log in
# if they already are a user, log in
try
:
user
=
User
.
objects
.
get
(
username
=
username
)
user
=
authenticate
(
username
=
username
,
password
=
password
)
login
(
request
,
user
)
# else create and activate account info
except
:
# create and activate account info
student
.
views
.
create_account
(
request
,
username
,
password
)
request
.
user
.
is_active
=
True
request
.
user
.
save
()
...
...
lms/envs/aws.py
View file @
e5f44165
...
...
@@ -178,6 +178,8 @@ for name, value in ENV_TOKENS.get("CODE_JAIL", {}).items():
COURSES_WITH_UNSAFE_CODE
=
ENV_TOKENS
.
get
(
"COURSES_WITH_UNSAFE_CODE"
,
[])
# automatic log in for load testing
MITX_FEATURES
[
'AUTOMATIC_AUTH_FOR_LOAD_TESTING'
]
=
ENV_TOKENS
.
get
(
'AUTOMATIC_AUTH_FOR_LOAD_TESTING'
)
############################## SECURE AUTH ITEMS ###############
# Secret things: passwords, access keys, etc.
...
...
lms/envs/common.py
View file @
e5f44165
...
...
@@ -37,8 +37,8 @@ PLATFORM_NAME = "edX"
COURSEWARE_ENABLED
=
True
ENABLE_JASMINE
=
False
AUTOMATIC_AUTH_FOR_LOAD_TESTING
=
True
MAX_AUTO_AUTH_USERS
=
2
# only relevant if MITX_FEATURES['AUTOMATIC_AUTH_FOR_LOAD_TESTING']
= True
MAX_AUTO_AUTH_USERS
=
2
0
GENERATE_RANDOM_USER_CREDENTIALS
=
False
PERFSTATS
=
False
...
...
@@ -150,6 +150,9 @@ MITX_FEATURES = {
# Allow use of the hint managment instructor view.
'ENABLE_HINTER_INSTRUCTOR_VIEW'
:
False
,
# for load testing
'AUTOMATIC_AUTH_FOR_LOAD_TESTING'
:
False
,
}
# Used for A/B testing
...
...
@@ -233,7 +236,7 @@ TEMPLATE_CONTEXT_PROCESSORS = (
)
# add csrf support unless disabled for load testing
if
not
AUTOMATIC_AUTH_FOR_LOAD_TESTING
:
if
not
MITX_FEATURES
.
get
(
'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
...
...
@@ -491,7 +494,7 @@ MIDDLEWARE_CLASSES = (
)
# add in csrf middleware unless disabled for load testing
if
not
AUTOMATIC_AUTH_FOR_LOAD_TESTING
:
if
not
MITX_FEATURES
.
get
(
'AUTOMATIC_AUTH_FOR_LOAD_TESTING'
)
:
MIDDLEWARE_CLASSES
=
MIDDLEWARE_CLASSES
+
(
'django.middleware.csrf.CsrfViewMiddleware'
,)
############################### Pipeline #######################################
...
...
lms/urls.py
View file @
e5f44165
...
...
@@ -440,7 +440,7 @@ if settings.DEBUG:
urlpatterns
+=
static
(
settings
.
STATIC_URL
,
document_root
=
settings
.
STATIC_ROOT
)
# enable automatic login
if
settings
.
AUTOMATIC_AUTH_FOR_LOAD_TESTING
:
if
settings
.
MITX_FEATURES
.
get
(
'AUTOMATIC_AUTH_FOR_LOAD_TESTING'
)
:
urlpatterns
+=
(
url
(
r'^auto_auth$'
,
'branding.views.auto_auth'
),
)
...
...
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