Merge lp:~deadlight/canonical-identity-provider/password-reset into lp:~deadlight/canonical-identity-provider/vanilla

Proposed by Karl Williams on 2019-07-30
Status: Merged
Approved by: Karl Williams on 2019-08-06
Approved revision: 1696
Merged at revision: 1696
Proposed branch: lp:~deadlight/canonical-identity-provider/password-reset
Merge into: lp:~deadlight/canonical-identity-provider/vanilla
Prerequisite: lp:~deadlight/canonical-identity-provider/faq
Diff against target: 264 lines (+93/-80)
4 files modified
src/webui/templates/bad_token.html (+19/-11)
src/webui/templates/registration/email_sent.html (+31/-34)
src/webui/templates/registration/forgot_password.html (+27/-21)
src/webui/templates/registration/reset_password.html (+16/-14)
To merge this branch: bzr merge lp:~deadlight/canonical-identity-provider/password-reset
Reviewer Review Type Date Requested Status
Anthony Dillon (community) Approve on 2019-08-05
Karl Williams Pending
Review via email: mp+370763@code.launchpad.net

Description of the change

Updated the password reset flow to Vanilla Framework

----

QA:

 - setup your environment as per the README
 - source ./env/bin/activate
 - make mail-debug
 [NEW TERMINAL]
 - source ./env/bin/activate
 - make start-db
 - make run
 - go to [HOST]:8000
 - Create a new user
 - Logout
 - Click "forgot password" under the login form
 - Check the page styling
 - Enter the email address for the created user and submit the form
 - Check the styling of the second step
 - Check the other terminal terminal to see the email that would be sent and copy the link provided
 - Check the styling of the form and submit
 - You can check the styling for the error where the link from the email is invalid buy visiting: [HOST]:8000/+bad-token

To post a comment you must log in.
Barry McGee (barry-mcgee) wrote :

Unfortunately cannot yet QA due to local env setup issues
Have eyeballed the code and raised some issues inline.

1696. By Karl Williams on 2019-08-05

Update spellings, fix malformed markup, hide email field correctly on password reset

Karl Williams (deadlight) wrote :

I've pushed fixes for all comments

Anthony Dillon (ya-bo-ng) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/webui/templates/bad_token.html'
--- src/webui/templates/bad_token.html 2013-02-27 12:19:30 +0000
+++ src/webui/templates/bad_token.html 2019-08-05 13:48:06 +0000
@@ -1,24 +1,32 @@
1{% extends "base.html" %}1{% extends "vanilla/base.html" %}
2{% load i18n %}2{% load i18n %}
3{% load static_url %}3{% load static_url %}
44
5{% comment %}5{% comment %}
6Copyright 2010 Canonical Ltd. This software is licensed under the6Copyright 2010-2019 Canonical Ltd. This software is licensed under the
7GNU Affero General Public License version 3 (see the file LICENSE).7GNU Affero General Public License version 3 (see the file LICENSE).
8{% endcomment %}8{% endcomment %}
99
10{% block title %}{% trans "Unauthorized confirmation code" %}{% endblock %}10{% block title %}{% trans "Unauthorised confirmation code" %}{% endblock %}
1111
12{% block text_title %}12{% block text_title %}
13 <h1 class="main">{% trans "Unauthorized confirmation code" %}</h1>13<h1>{% trans "Unauthorised confirmation code" %}</h1>
14{% endblock %}14{% endblock %}
1515
16{% block content %}16{% block content %}
17<p>{% blocktrans %}You are not authorized to use this confirmation code.17<section class="p-strip">
18If this URL was sent to you by email, please make sure you open it in the same browser where you requested it.18 <div class="row">
19{% endblocktrans %}</p>19 <div class="col-8">
2020 <div class="p-notification--negative">
21<p>{% blocktrans %}You can also seek further assistance on:{% endblocktrans %}</p>21 <p class="p-notification__response">
2222 <span class="p-notification__status">Error:</span>{% blocktrans %}You are not authorised to use this confirmation code.
23<a href="{{ 'support_form'|static_url }}">{{ "support_form"|static_url }}</a>23 If this URL was sent to you by email, please make sure you open it in the same browser where you requested it.
24 {% endblocktrans %}
25 </p>
26 </div>
27 <p>{% blocktrans %}You can also seek further assistance on:{% endblocktrans %}</p>
28 <p><a href="{{ 'support_form'|static_url }}">{{ "support_form"|static_url }}</a></p>
29 </div>
30 </div>
31</section>
24{% endblock %}32{% endblock %}
2533
=== modified file 'src/webui/templates/registration/email_sent.html'
--- src/webui/templates/registration/email_sent.html 2017-02-26 13:52:43 +0000
+++ src/webui/templates/registration/email_sent.html 2019-08-05 13:48:06 +0000
@@ -1,4 +1,4 @@
1{% extends "base.html" %}1{% extends "vanilla/base.html" %}
2{% load i18n %}2{% load i18n %}
3{% load static_url %}3{% load static_url %}
4{% load url_with_token %}4{% load url_with_token %}
@@ -13,36 +13,33 @@
13{% block title %}{{ email_heading }}{% endblock %}13{% block title %}{{ email_heading }}{% endblock %}
1414
15{% block text_title %}15{% block text_title %}
16 <h1 class="u1-h-main u1-h-pair">{{ email_heading }}</h1>16 <h1>{{ email_heading }}</h1>
17 <h2 class="u1-h-med u1-h-pair">{% trans "Step 2 of 3: Check your email" %}</h2>
18{% endblock %}17{% endblock %}
1918
20{% block content %}19{% block content %}
2120<section class="p-strip">
22{% if user.is_authenticated %}<div class="email-sent-auth">{% endif %}21 <div class="row">
2322 <div class="col-8">
24<div>23 <h2 class="p-heading--three">{% trans "Step 2 of 3: Check your email" %}</h2>
25 <div>24 {% if user.is_authenticated %}<div class="email-sent-auth">{% endif %}
26 <p class="larger">{{ email_reason|safe }}</p>25 <p class="larger">{{ email_reason|safe }}</p>
27 </div>26 {% if not readonly %}
2827 <p>
29{% if not readonly %}
30 <p>
31 {% url_with_token 'account-emails' as emails_url %}28 {% url_with_token 'account-emails' as emails_url %}
32 {% if user.is_authenticated %}<a href="{{ emails_url }}" data-qa-id="return_to_email_addresses_link">{% blocktrans %}Return to email addresses{% endblocktrans %}</a>{% endif %}29 {% if user.is_authenticated %}<a href="{{ emails_url }}" data-qa-id="return_to_email_addresses_link">{% blocktrans %}Return to email addresses{% endblocktrans %}</a>{% endif %}
33 </p>30 </p>
34{% endif %}31 {% endif %}
35</div>32 <div class="password-reset-advice">
3633 <h2 class="p-heading--three">{% trans "Haven&rsquo;t received the email within a couple of minutes?" %}</h2>
37<div class="password-reset-advice">34 <ul class="p-list">
38 <h2 class=u1-h-small>{% trans "Haven&rsquo;t received the email within a couple of minutes?" %}</h2>35 <li class="p-list__item is-ticked">{% blocktrans %}Make sure you typed the right email address.{% endblocktrans %}</li>
39 <ul class=u1-list>36 <li class="p-list__item is-ticked">{% blocktrans %}Check your spam folder.{% endblocktrans %}</li>
40 <li>{% blocktrans %}Make sure you typed the right email address.{% endblocktrans %}</li>37 <li class="p-list__item is-ticked">{% blocktrans with url='support_form'|static_url %}Still nothing? Contact <a href="{{ url }}">Ubuntu One Support</a>{% endblocktrans %}</li>
41 <li>{% blocktrans %}Check your spam folder.{% endblocktrans %}</li>38 </ul>
42 <li>{% blocktrans with url='support_form'|static_url %}Still nothing? Contact <a href="{{ url }}">Ubuntu One Support</a>{% endblocktrans %}</li>39 </div>
43 </ul>40 </div>
44</div>41 </div>
4542</section>
46{% if user.is_authenticated %}</div>{% endif %}43{% if user.is_authenticated %}</div>{% endif %}
4744
48{% endblock %}45{% endblock %}
@@ -50,14 +47,14 @@
50{% block extra_js %}47{% block extra_js %}
51<script>48<script>
52YUI().use('node', function (Y) {49YUI().use('node', function (Y) {
53 Y.one('#confirmation_code').on(['keyup', 'focus', 'blur', 'change'], function() {50 Y.one('#confirmation_code').on(['keyup', 'focus', 'blur', 'change'], function() {
54 var code = Y.one('#confirmation_code').get('value');51 var code = Y.one('#confirmation_code').get('value');
55 if (code.length === 0) {52 if (code.length === 0) {
56 Y.one('#submit').setAttribute('disabled', 'true');53 Y.one('#submit').setAttribute('disabled', 'true');
57 } else {54 } else {
58 Y.one('#submit').removeAttribute('disabled');55 Y.one('#submit').removeAttribute('disabled');
59 }56 }
60 });57 });
61});58});
62</script>59</script>
63{% endblock %}60{% endblock %}
6461
=== modified file 'src/webui/templates/registration/forgot_password.html'
--- src/webui/templates/registration/forgot_password.html 2013-10-18 12:59:55 +0000
+++ src/webui/templates/registration/forgot_password.html 2019-08-05 13:48:06 +0000
@@ -1,8 +1,8 @@
1{% extends "base.html" %}1{% extends "vanilla/base.html" %}
2{% load i18n %}2{% load i18n %}
33
4{% comment %}4{% comment %}
5Copyright 2010 Canonical Ltd. This software is licensed under the5Copyright 2010-2019 Canonical Ltd. This software is licensed under the
6GNU Affero General Public License version 3 (see the file LICENSE).6GNU Affero General Public License version 3 (see the file LICENSE).
7{% endcomment %}7{% endcomment %}
88
@@ -11,34 +11,40 @@
11{% block title %}{% trans "Reset password" %}{% endblock %}11{% block title %}{% trans "Reset password" %}{% endblock %}
1212
13{% block text_title %}13{% block text_title %}
14 <h1 class="u1-h-main u1-h-pair">{% trans "Reset password" %}</h1>14<h1>{% trans "Reset password" %}</h1>
15 <h2 class="u1-h-med u1-h-pair">{% trans "Step 1 of 3: Type your email address" %}</h2>
16{% endblock %}15{% endblock %}
1716
18{% block content_id %}auth{% endblock %}17{% block content_id %}auth{% endblock %}
1918
20{% block content %}19{% block content %}
21 <p>{% blocktrans %}Enter your email address, and we will send you instructions on how to reset your password.{% endblocktrans %}</p>20<section class="p-strip">
22 <form action="" method="post">21 <div class="row">
22 <div class="col-8">
23 <h2 class="p-heading--three">{% trans "Step 1 of 3: Type your email address" %}</h2>
24 <p>{% blocktrans %}Enter your email address, and we will send you instructions on how to reset your password.{% endblocktrans %}</p>
25 <form action="" method="post">
23 {% csrf_token %}26 {% csrf_token %}
2427
25 {% if form.non_field_errors %}28 {% if form.non_field_errors %}
26 <div class="input-row haserrors">29 <div class="p-notification--negative">
27 <span class="error">{{ form.non_field_errors|join:"" }}</span>30 <p class="p-notification__response">
31 <span class="p-notification__status">Error:</span>{{ form.non_field_errors|join:"" }}
32 </p>
28 </div>33 </div>
29 {% endif %}34 {% endif %}
3035
31 <p class="input-row{% if form.email.errors %} haserrors{% endif %}">36 <div class="p-form-validation{% if form.email.errors %} is-error{% endif %}">
32 <label for="id_email">{% trans "Email:" %}</label>37 <label for="id_email">{% trans "Email:" %}</label>
33 {{ form.email }}38 {{ form.email }}
34 {% if form.email.errors %}39 {% if form.email.errors %}
35 <span class="error">{{ form.email.errors|first }}</span>40 <p class="p-form-validation__message">
36 {% endif %}41 <strong>Error:</strong> {{ form.email.errors|first }}
37 </p>42 </p>
38 <p class="actions">43 {% endif %}
39 <button type="submit" name="continue" class="btn cta" data-qa-id="send_password_reset_token">44 </div>
40 <span><span>{% trans "Continue" %}</span></span>45 <button type="submit" name="continue" class="p-button--positive" data-qa-id="send_password_reset_token">{% trans "Continue" %}</button>
41 </button>46 </form>
42 </p>47 </div>
43 </form>48 </div>
49</section>
44{% endblock %}50{% endblock %}
4551
=== modified file 'src/webui/templates/registration/reset_password.html'
--- src/webui/templates/registration/reset_password.html 2015-11-09 16:25:17 +0000
+++ src/webui/templates/registration/reset_password.html 2019-08-05 13:48:06 +0000
@@ -1,4 +1,4 @@
1{% extends "base.html" %}1{% extends "vanilla/base.html" %}
2{% load i18n %}2{% load i18n %}
33
4{% comment %}4{% comment %}
@@ -11,24 +11,26 @@
11{% block title %}{% trans "Reset password" %}{% endblock %}11{% block title %}{% trans "Reset password" %}{% endblock %}
1212
13{% block text_title %}13{% block text_title %}
14 <h1 class="u1-h-main u1-h-pair">{% trans "Reset password" %}</h1>14<h1>{% trans "Reset password" %}</h1>
15 <h2 class="u1-h-med u1-h-pair">{% trans "Step 3 of 3: Choose a new password" %}</h2>
16{% endblock %}15{% endblock %}
1716
18{% block content_id %}auth{% endblock %}17{% block content_id %}auth{% endblock %}
1918
20{% block content %}19{% block content %}
21 <form id="login-form" class="longfields" method="post" action="{{ action }}">20<section class="p-strip">
22 {% csrf_token %}21 <div class="row">
23 <!-- Refer to LP: #1413665 for more information about this email field. -->22 <div class="col-6">
24 <input type="email" name="email" value="{{ email }}" style="display: none;" />23 <h2 class="p-heading--three">{% trans "Step 3 of 3: Choose a new password" %}</h2>
25 {% include "widgets/passwords.html" with edit_account_labels=1 fields=form %}24 <form id="login-form" method="post" action="{{ action }}">
26 <p class="actions">25 {% csrf_token %}
27 <button type="submit" name="continue" class="btn cta" data-qa-id="reset_password">26 <!-- Refer to LP: #1413665 for more information about this email field. -->
28 <span><span>{% trans "Continue" %}</span></span>27 <input type="hidden" name="email" value="{{ email }}" />
29 </button>28 {% include "vanilla/widgets/passwords.html" with edit_account_labels=1 fields=form %}
30 </p>29 <button type="submit" name="continue" class="p-button--positive" data-qa-id="reset_password">{% trans "Continue" %}</button>
31 </form>30 </form>
31 </div>
32 </div>
33</section>
32{% endblock %}34{% endblock %}
3335
34{% block extra_js %}36{% block extra_js %}

Subscribers

People subscribed via source and target branches

to all changes: