Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
a9afba07
Commit
a9afba07
authored
10 years ago
by
Adam
Browse files
Options
Downloads
Plain Diff
Merge pull request #5442 from edx/adam/update-template
update password reset template (TNL-503)
parents
fe54325c
0c4f98a8
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
common/djangoapps/student/tests/test_reset_password.py
+26
-0
26 additions, 0 deletions
common/djangoapps/student/tests/test_reset_password.py
lms/templates/registration/password_reset_email.html
+1
-1
1 addition, 1 deletion
lms/templates/registration/password_reset_email.html
with
27 additions
and
1 deletion
common/djangoapps/student/tests/test_reset_password.py
+
26
−
0
View file @
a9afba07
...
...
@@ -16,12 +16,14 @@ from django.utils.http import int_to_base36
from
mock
import
Mock
,
patch
from
textwrap
import
dedent
import
ddt
from
student.views
import
password_reset
,
password_reset_confirm_wrapper
from
student.tests.factories
import
UserFactory
from
student.tests.test_email
import
mock_render_to_string
@ddt.ddt
class
ResetPasswordTests
(
TestCase
):
"""
Tests that clicking reset password sends email, and doesn
'
t activate the user
"""
...
...
@@ -121,6 +123,30 @@ class ResetPasswordTests(TestCase):
self
.
assertFalse
(
self
.
user
.
is_active
)
re
.
search
(
r
'
password_reset_confirm/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/
'
,
msg
).
groupdict
()
@unittest.skipIf
(
settings
.
FEATURES
.
get
(
'
DISABLE_RESET_EMAIL_TEST
'
,
False
),
dedent
(
"""
Skipping Test because CMS has not provided necessary templates for password reset.
If LMS tests print this message, that needs to be fixed.
"""
)
)
@patch
(
'
django.core.mail.send_mail
'
)
@ddt.data
((
False
,
'
http://
'
),
(
True
,
'
https://
'
))
@ddt.unpack
def
test_reset_password_email_https
(
self
,
is_secure
,
protocol
,
send_email
):
"""
Tests that the right url protocol is included in the reset password link
"""
req
=
self
.
request_factory
.
post
(
'
/password_reset/
'
,
{
'
email
'
:
self
.
user
.
email
}
)
req
.
is_secure
=
Mock
(
return_value
=
is_secure
)
resp
=
password_reset
(
req
)
_
,
msg
,
_
,
_
=
send_email
.
call_args
[
0
]
expected_msg
=
"
Please go to the following page and choose a new password:
\n\n
"
+
protocol
self
.
assertIn
(
expected_msg
,
msg
)
@patch
(
'
student.views.password_reset_confirm
'
)
def
test_reset_password_bad_token
(
self
,
reset_confirm
):
"""
Tests bad token and uidb36 in password reset
"""
...
...
This diff is collapsed.
Click to expand it.
lms/templates/registration/password_reset_email.html
+
1
−
1
View file @
a9afba07
...
...
@@ -3,7 +3,7 @@
{% trans "Please go to the following page and choose a new password:" %}
{% block reset_link %}
http{% if is_secure %}s{% endif %
}://{{domain}}{% url 'student.views.password_reset_confirm_wrapper' uidb36=uid token=token %}
{{ protocol }
}://{{domain}}{% url 'student.views.password_reset_confirm_wrapper' uidb36=uid token=token %}
{% endblock %}
{% trans "If you didn't request this change, you can disregard this email - we have not yet reset your password." %}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment