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
5097bd6e
Commit
5097bd6e
authored
May 02, 2017
by
Matt Drayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mattdrayer/ENT-328: Update account activation message on sign-in form.
parent
a047d009
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
7 deletions
+42
-7
cms/envs/common.py
+3
-0
common/djangoapps/student/tests/test_login.py
+3
-3
common/djangoapps/student/views.py
+35
-3
common/djangoapps/third_party_auth/tests/specs/base.py
+1
-1
No files found.
cms/envs/common.py
View file @
5097bd6e
...
...
@@ -90,7 +90,10 @@ from lms.envs.common import (
FILE_UPLOAD_STORAGE_PREFIX
,
COURSE_ENROLLMENT_MODES
,
HELP_TOKENS_BOOKS
,
SUPPORT_SITE_LINK
,
)
from
path
import
Path
as
path
from
warnings
import
simplefilter
...
...
common/djangoapps/student/tests/test_login.py
View file @
5097bd6e
...
...
@@ -126,7 +126,7 @@ class LoginTest(CacheIsolationTestCase):
# Should now be unable to login
response
,
mock_audit_log
=
self
.
_login_response
(
'test@edx.org'
,
'test_password'
)
self
.
_assert_response
(
response
,
success
=
False
,
value
=
"
Before you sign in, you need to activate your account
"
)
value
=
"
In order to sign in, you need to activate your account.
"
)
self
.
_assert_audit_log
(
mock_audit_log
,
'warning'
,
[
u'Login failed'
,
u'Account not active for user'
])
@patch.dict
(
"django.conf.settings.FEATURES"
,
{
'SQUELCH_PII_IN_LOGS'
:
True
})
...
...
@@ -138,7 +138,7 @@ class LoginTest(CacheIsolationTestCase):
# Should now be unable to login
response
,
mock_audit_log
=
self
.
_login_response
(
'test@edx.org'
,
'test_password'
)
self
.
_assert_response
(
response
,
success
=
False
,
value
=
"
Before you sign in, you need to activate your account
"
)
value
=
"
In order to sign in, you need to activate your account.
"
)
self
.
_assert_audit_log
(
mock_audit_log
,
'warning'
,
[
u'Login failed'
,
u'Account not active for user'
])
self
.
_assert_not_in_audit_log
(
mock_audit_log
,
'warning'
,
[
u'test'
])
...
...
@@ -408,7 +408,7 @@ class LoginTest(CacheIsolationTestCase):
if
value
is
not
None
:
msg
=
(
"'
%
s' did not contain '
%
s'"
%
(
str
(
response_dict
[
'value'
]),
str
(
value
)))
(
unicode
(
response_dict
[
'value'
]),
unicode
(
value
)))
self
.
assertIn
(
value
,
response_dict
[
'value'
],
msg
)
def
_assert_audit_log
(
self
,
mock_audit_log
,
level
,
log_strings
):
...
...
common/djangoapps/student/views.py
View file @
5097bd6e
...
...
@@ -1236,6 +1236,39 @@ def change_enrollment(request, check_access=True):
return
HttpResponseBadRequest
(
_
(
"Enrollment action is invalid"
))
def
_generate_not_activated_message
(
user
):
"""
Generates the message displayed on the sign-in screen when a learner attempts to access the
system with an inactive account.
Arguments:
user (User): User object for the learner attempting to sign in.
"""
support_url
=
configuration_helpers
.
get_value
(
'SUPPORT_SITE_LINK'
,
settings
.
SUPPORT_SITE_LINK
)
platform_name
=
configuration_helpers
.
get_value
(
'PLATFORM_NAME'
,
settings
.
PLATFORM_NAME
)
not_activated_msg_template
=
_
(
'In order to sign in, you need to activate your account.<br /><br />'
'We just sent an activation link to <strong>{email}</strong>. If '
'you do not receive an email, check your spam folders or '
'<a href="{support_url}">contact {platform} Support</a>.'
)
not_activated_message
=
not_activated_msg_template
.
format
(
email
=
user
.
email
,
support_url
=
support_url
,
platform
=
platform_name
)
return
not_activated_message
# Need different levels of logging
@ensure_csrf_cookie
def
login_user
(
request
,
error
=
""
):
# pylint: disable=too-many-statements,unused-argument
...
...
@@ -1456,11 +1489,10 @@ def login_user(request, error=""): # pylint: disable=too-many-statements,unused
AUDIT_LOG
.
warning
(
u"Login failed - Account not active for user {0}, resending activation"
.
format
(
username
))
reactivation_email_for_user
(
user
)
not_activated_msg
=
_
(
"Before you sign in, you need to activate your account. We have sent you an "
"email message with instructions for activating your account."
)
return
JsonResponse
({
"success"
:
False
,
"value"
:
not_activated_msg
,
"value"
:
_generate_not_activated_message
(
user
)
,
})
# TODO: this should be status code 400 # pylint: disable=fixme
...
...
common/djangoapps/third_party_auth/tests/specs/base.py
View file @
5097bd6e
...
...
@@ -365,7 +365,7 @@ class IntegrationTest(testutil.TestCase, test.TestCase):
self
.
assertEqual
(
200
,
response
.
status_code
)
# Yes, it's a 200 even though it's a failure.
payload
=
json
.
loads
(
response
.
content
)
self
.
assertFalse
(
payload
.
get
(
'success'
))
self
.
assertIn
(
'
Before you sign in, you need to activate your account
'
,
payload
.
get
(
'value'
))
self
.
assertIn
(
'
In order to sign in, you need to activate your account.
'
,
payload
.
get
(
'value'
))
def
assert_json_failure_response_is_missing_social_auth
(
self
,
response
):
"""Asserts failure on /login for missing social auth looks right."""
...
...
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