Escape validation error messages on reset password page.

Properly escape validation error messages on reset password page while
passing to reactJS.

LEARNER-6356
This commit is contained in:
Waheed Ahmed
2018-09-13 15:40:47 +05:00
parent 3c654234c9
commit 00c7cce1d8
2 changed files with 4 additions and 3 deletions

View File

@@ -169,7 +169,7 @@ class TestPasswordHistory(LoginEnrollmentTestCase):
student_email, _ = self._setup_user()
user = User.objects.get(email=student_email)
err_msg = 'You are re-using a password that you have used recently. You must have 1 distinct password'
err_msg = 'You are re\\\\u002Dusing a password that you have used recently. You must have 1 distinct password'
success_msg = 'Your Password Reset is Complete'
token = default_token_generator.make_token(user)
@@ -199,7 +199,7 @@ class TestPasswordHistory(LoginEnrollmentTestCase):
staff_email, _ = self._setup_user(is_staff=True)
user = User.objects.get(email=staff_email)
err_msg = 'You are re-using a password that you have used recently. You must have 2 distinct passwords'
err_msg = 'You are re\\\\u002Dusing a password that you have used recently. You must have 2 distinct passwords'
success_msg = 'Your Password Reset is Complete'
token = default_token_generator.make_token(user)

View File

@@ -4,6 +4,7 @@
<%!
from django.utils.translation import ugettext as _
from openedx.core.djangolib.js_utils import js_escaped_string
from openedx.core.djangolib.markup import HTML, Text
%>
@@ -28,7 +29,7 @@ from openedx.core.djangolib.markup import HTML, Text
id="password-reset-confirm-react",
props={
'csrfToken': csrf_token,
'errorMessage': err_msg if err_msg else '',
'errorMessage': js_escaped_string(err_msg) if err_msg else '',
},
)}
% else: