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
1e53a797
Commit
1e53a797
authored
Feb 24, 2015
by
Awais
Committed by
Awais Qureshi
Feb 25, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ECOM-985 fixing the 'NoneType' object has no attribute 'profile'.
parent
6f7a0665
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
1 deletions
+25
-1
common/djangoapps/student/models.py
+2
-1
common/djangoapps/student/tests/test_login.py
+23
-0
No files found.
common/djangoapps/student/models.py
View file @
1e53a797
...
...
@@ -1419,7 +1419,8 @@ def enforce_single_login(sender, request, user, signal, **kwargs): # pylint:
key
=
request
.
session
.
session_key
else
:
key
=
None
user
.
profile
.
set_login_session
(
key
)
if
user
:
user
.
profile
.
set_login_session
(
key
)
class
DashboardConfiguration
(
ConfigurationModel
):
...
...
common/djangoapps/student/tests/test_login.py
View file @
1e53a797
...
...
@@ -212,6 +212,29 @@ class LoginTest(TestCase):
# client1 will be logged out
self
.
assertEqual
(
response
.
status_code
,
302
)
@patch.dict
(
"django.conf.settings.FEATURES"
,
{
'PREVENT_CONCURRENT_LOGINS'
:
True
})
def
test_single_session_with_url_not_having_login_required_decorator
(
self
):
# accessing logout url as it does not have login-required decorator it will avoid redirect
# and go inside the enforce_single_login
creds
=
{
'email'
:
'test@edx.org'
,
'password'
:
'test_password'
}
client1
=
Client
()
client2
=
Client
()
response
=
client1
.
post
(
self
.
url
,
creds
)
self
.
_assert_response
(
response
,
success
=
True
)
self
.
assertEqual
(
self
.
user
.
profile
.
get_meta
()[
'session_id'
],
client1
.
session
.
session_key
)
# second login should log out the first
response
=
client2
.
post
(
self
.
url
,
creds
)
self
.
_assert_response
(
response
,
success
=
True
)
url
=
reverse
(
'logout'
)
response
=
client1
.
get
(
url
)
self
.
assertEqual
(
response
.
status_code
,
302
)
def
test_change_enrollment_400
(
self
):
"""
Tests that a 400 in change_enrollment doesn't lead to a 404
...
...
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