Commit 178f5a60 by Waheed Ahmed

Fixed the other half of forgot password flow accourding to logistration.

ECOM-2947
parent 5f51db0a
...@@ -100,7 +100,7 @@ class StudentAccountUpdateTest(UrlResetMixin, TestCase): ...@@ -100,7 +100,7 @@ class StudentAccountUpdateTest(UrlResetMixin, TestCase):
follow=True follow=True
) )
self.assertEqual(response.status_code, 200) self.assertEqual(response.status_code, 200)
self.assertContains(response, "Your password has been set.") self.assertContains(response, "Your password has been reset.")
# Log the user out to clear session data # Log the user out to clear session data
self.client.logout() self.client.logout()
...@@ -116,7 +116,7 @@ class StudentAccountUpdateTest(UrlResetMixin, TestCase): ...@@ -116,7 +116,7 @@ class StudentAccountUpdateTest(UrlResetMixin, TestCase):
follow=True follow=True
) )
self.assertEqual(response.status_code, 200) self.assertEqual(response.status_code, 200)
self.assertContains(response, "The password reset link was invalid, possibly because the link has already been used.") self.assertContains(response, "This password reset link is invalid. It may have been used already.")
self.client.logout() self.client.logout()
......
/**
* Password reset template JS.
*/
$(function() {
'use strict';
// adding js class for styling with accessibility in mind
$("body").addClass("js");
// form field label styling on focus
$("form :input").focus(function() {
$("label[for='" + this.id + "']").parent().addClass("is-focused");
}).blur(function() {
$("label").parent().removeClass("is-focused");
});
});
...@@ -10,8 +10,6 @@ ...@@ -10,8 +10,6 @@
{% stylesheet 'style-vendor' %} {% stylesheet 'style-vendor' %}
{% stylesheet 'style-main' %} {% stylesheet 'style-main' %}
{% stylesheet 'style-course-vendor' %}
{% stylesheet 'style-course' %}
{% block main_vendor_js %} {% block main_vendor_js %}
{% javascript 'main_vendor' %} {% javascript 'main_vendor' %}
......
...@@ -8,23 +8,9 @@ ...@@ -8,23 +8,9 @@
{% block bodyextra %} {% block bodyextra %}
<script type="text/javascript"> <script type="text/javascript">
$(function() { $(function() {
'use strict';
// adding js class for styling with accessibility in mind // adding js class for styling with accessibility in mind
$('body').addClass('js'); $('body').addClass('js');
// new window/tab opening
$('a[rel="external"], a[class="new-vp"]')
.click( function() {
window.open( $(this).attr('href') );
return false;
});
// form field label styling on focus
$("form :input").focus(function() {
$("label[for='" + this.id + "']").parent().addClass("is-focused");
}).blur(function() {
$("label").parent().removeClass("is-focused");
});
}); });
</script> </script>
{% endblock %} {% endblock %}
...@@ -32,23 +18,18 @@ ...@@ -32,23 +18,18 @@
{% block bodyclass %}view-passwordreset{% endblock %} {% block bodyclass %}view-passwordreset{% endblock %}
{% block body %} {% block body %}
<section class="introduction"> <div id="password-reset-complete-container" class="login-register">
<header> <section id="password-reset-complete-anchor" class="form-type">
<h1 class="title"> <div id="password-reset-complete" class="form-wrapper" aria-hidden="true">
<span class="title-super"> <div class="status submission-success" aria-live="polite">
{% trans "Your Password Reset is Complete" %} <h4 class="message-title">{% trans "Password Reset Complete" %}</h4>
</span> <ul class="message-copy">
</h1>
</header>
</section>
<section class="passwordreset container">
{% block content %}
<section role="main" class="content">
{% blocktrans with link_start='<a href="/login">' link_end='</a>' %} {% blocktrans with link_start='<a href="/login">' link_end='</a>' %}
Your password has been set. You may go ahead and {{ link_start }}log in{{ link_end }} now. Your password has been reset. {{ link_start }}Sign in to your account.{{ link_end }}
{% endblocktrans %} {% endblocktrans %}
</ul>
</div>
</div>
</section> </section>
{% endblock %} </div>
</section>
{% endblock %} {% endblock %}
...@@ -3,148 +3,70 @@ ...@@ -3,148 +3,70 @@
{% block title %} {% block title %}
<title> <title>
{% blocktrans with platform_name=platform_name %} {% blocktrans with platform_name=platform_name %}
Reset Your {{ platform_name }} Password Reset Your {{ platform_name }} Password
{% endblocktrans %} {% endblocktrans %}
</title> </title>
{% endblock %} {% endblock %}
{% block bodyextra %} {% block bodyextra %}
<script type="text/javascript"> <script type="text/javascript" src="{{STATIC_URL}}js/student_account/password_reset.js"></script>
$(function() {
// adding js class for styling with accessibility in mind
$('body').addClass('js');
// new window/tab opening
$('a[rel="external"], a[class="new-vp"]')
.click( function() {
window.open( $(this).attr('href') );
return false;
});
// form field label styling on focus
$("form :input").focus(function() {
$("label[for='" + this.id + "']").parent().addClass("is-focused");
}).blur(function() {
$("label").parent().removeClass("is-focused");
});
});
</script>
{% endblock %} {% endblock %}
{% block bodyclass %}view-passwordreset{% endblock %} {% block bodyclass %}view-passwordreset{% endblock %}
{% block body %} {% block body %}
<section class="introduction"> <div id="password-reset-confirm-container" class="login-register">
<header> <section id="password-reset-confirm-anchor" class="form-type">
<h1 class="title"> <div id="password-reset-confirm-form" class="form-wrapper" aria-hidden="true">
<span class="title-super"> <div class="status submission-error {% if not err_msg %} hidden {% endif %}" aria-live="polite">
{% blocktrans with platform_name=platform_name %} <h4 class="message-title">{% trans "Error Resetting Password" %}</h4>
Reset Your {{ platform_name }} Password
{% endblocktrans %}
</span>
</h1>
</header>
</section>
<section class="passwordreset container">
<section role="main" class="content">
{% if validlink %}
<header>
<h2 class="sr">{% trans "Password Reset Form" %}</h2>
</header>
<form role="form" id="passwordreset-form" method="post" action="">{% csrf_token %}
<!-- status messages -->
<div role="alert" class="status message">
<h3 class="message-title">
{% blocktrans %}
We're sorry, but this version of your browser is not supported. Try again using a different browser or a newer version of your browser.
{% endblocktrans %}
</h3>
</div>
{% if err_msg %}
<div role="alert" class="status message submission-error" style="display: block;">
{% else %}
<div role="alert" class="status message submission-error" style="display: none;">
{% endif %}
<h3 class="message-title">{% trans "The following errors occurred while processing your registration: " %}</h3>
<ul class="message-copy"> <ul class="message-copy">
{% if err_msg %} {% if err_msg %}
<li>{{err_msg}}</li> <li>{{err_msg}}</li>
{% else %} {% else %}
<li>{% trans "You must complete all fields." %}</li> <li>{% trans "You must enter and confirm your new password." %}</li>
<li>{% trans "The two password fields didn't match." %}</li> <li>{% trans "The text in both password fields must match." %}</li>
{% endif %} {% endif %}
</ul> </ul>
</div> </div>
{% if validlink %}
<div role="alert" class="status message system-error"> <form role="form" id="passwordreset-form" method="post" action="">{% csrf_token %}
<h3 class="message-title">{% trans "We're sorry, our systems seem to be having trouble processing your password reset" %}</h3> <div class="section-title lines">
<p class="message-copy"> <h2>
{% blocktrans with start_link='<a href="{{MKTG_URL_CONTACT}}">' end_link='</a>' %} <span class="text">
Someone has been made aware of this issue. Please try again shortly. Please {{ start_link }}contact us{{ end_link }} about any concerns you have. {% trans "Reset Your Password" %}
{% endblocktrans %} </span>
</p> </h2>
</div> </div>
<p class="instructions"> <p class="action-label">
{% trans 'Please enter your new password twice so we can verify you typed it in correctly.' %} {% trans "Enter and confirm your new password." %}
<br />
{% blocktrans with bold_start='<strong class="indicator">' bold_end='</strong>' %}
Required fields are noted by {{bold_start}}bold text and an asterisk (*){{bold_end}}.
{% endblocktrans %}
</p> </p>
<fieldset class="group group-form group-form-requiredinformation"> <div class="form-field new_password1-new_password1">
<legend class="sr">{% trans "Required Information" %}</legend> <label for="new_password1">{% trans "New Password" %}</label>
<ol class="list-input">
<li class="field required password" id="field-new_password1">
<label for="new_password1">{% trans "Your New Password" %}</label>
<input id="new_password1" type="password" name="new_password1" placeholder="*****" /> <input id="new_password1" type="password" name="new_password1" placeholder="*****" />
</li> </div>
<li class="field required password" id="field-new_password2"> <div class="form-field new_password2-new_password2">
<label for="new_password2">{% trans "Your New Password Again" %}</label> <label for="new_password2">{% trans "Confirm Password" %}</label>
<input id="new_password2" type="password" name="new_password2" placeholder="*****" /> <input id="new_password2" type="password" name="new_password2" placeholder="*****" />
</li>
</ol>
</fieldset>
<div class="form-actions">
<button name="submit" type="submit" id="submit" class="action action-primary action-update">{% trans "Change My Password" %}</button>
</div> </div>
</form>
<button type="submit" class="action action-primary action-update js-reset">{% trans "Reset My Password" %}</button>
</form>
{% else %} {% else %}
<div class="status submission-error" aria-live="polite">
<header> <h4 class="message-title">{% trans "Invalid Password Reset Link" %}</h4>
<h2 class="sr">{% trans "Your Password Reset Was Unsuccessful" %}</h2> <ul class="message-copy">
</header>
<p>
{% blocktrans with start_link='<a href="/login">' end_link='</a>' %} {% blocktrans with start_link='<a href="/login">' end_link='</a>' %}
The password reset link was invalid, possibly because the link has already been used. Please return to the {{ start_link }}login page{{ end_link }} and start the password reset process again. This password reset link is invalid. It may have been used already. To reset your password, go to the {{ start_link }}sign-in{{ end_link }} page and select <strong>Forgot password</strong>.
{% endblocktrans %} {% endblocktrans %}
</p> </ul>
</div>
{% endif %} {% endif %}
</section>
<aside role="complementary">
<header>
<h3 class="sr">{% trans "Password Reset Help" %}</h3>
</header>
<div class="cta cta-help">
<h3>{% trans "Need Help?" %}</h3>
<p>
{% blocktrans with start_link='<a href="{{MKTG_URL_FAQ}}">' end_link='</a>' %}
View our {{ start_link }}help section for contact information and answers to commonly asked questions{{ end_link }}
{% endblocktrans %}
</p>
</div> </div>
</aside>
</section> </section>
</div>
{% endblock %} {% endblock %}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment