Merge ~roadmr/canonical-identity-provider:2fa-backup-ux-tweaks into canonical-identity-provider:master

Proposed by Daniel Manrique
Status: Merged
Approved by: Daniel Manrique
Approved revision: 2fa248f2250b05b54f3b854e194d252af09093e8
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~roadmr/canonical-identity-provider:2fa-backup-ux-tweaks
Merge into: canonical-identity-provider:master
Diff against target: 110 lines (+16/-19)
4 files modified
src/webui/templates/device/verify.html (+7/-9)
src/webui/templates/registration/twofactor.html (+5/-6)
src/webui/tests/test_views_devices.py (+1/-1)
src/webui/tests/test_views_ui.py (+3/-3)
Reviewer Review Type Date Requested Status
Maximiliano Bertacchini Approve
Review via email: mp+392807@code.launchpad.net

Commit message

UX changes for 2FA backup enforcement/reminders based on review by design team.

Description of the change

To post a comment you must log in.
Revision history for this message
Maximiliano Bertacchini (maxiberta) wrote :

Nice! +1 with the littlest nitpick.

review: Approve
Revision history for this message
Maximiliano Bertacchini (maxiberta) wrote :

One extra question.

Revision history for this message
Daniel Manrique (roadmr) wrote :

Thanks, change coming up.

2fa248f... by Daniel Manrique

separate title from content

Revision history for this message
Maximiliano Bertacchini (maxiberta) wrote :

+1 thanks!

review: Approve
Revision history for this message
Ovidiu Suciu (solazio) wrote :

The reason you get a slightly different look than the design, is the old vanilla version we are using on this project. It should be updated to the latest version (2.19.2) https://vanillaframework.io/docs

If you do it, keep in mind that all the pages will require QA as it might break some things.

If you don't want to do it, I suggest to stick to what you have, and I will try to upgrade it once Charmhub madness calms down a bit.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/src/webui/templates/device/verify.html b/src/webui/templates/device/verify.html
2index eeb2cf1..972b960 100644
3--- a/src/webui/templates/device/verify.html
4+++ b/src/webui/templates/device/verify.html
5@@ -24,8 +24,8 @@ Affero General Public License version 3 (see the file LICENSE).
6 {% if devices %}
7 <div id="auth-devices" class="col-6">
8 <form id="login-form" action="" method="post" name="loginform">
9- <h2>{% trans "Periodic verification for your authentication devices" %}</h2>
10- <h3 class="p-heading--four">{% trans "Please verify that your list of devices is up to date." %}</h3>
11+ <h2>{% trans "Verify that your devices are up to date" %}</h2>
12+ <p>{% trans "We periodically check to make sure you keep your backup devices always up to date." %}</p>
13 <div class="p-strip is-shallow">
14 <table id="device-list" data-qa-id="device_list" class="p-table--bordered">
15 <thead>
16@@ -54,21 +54,19 @@ Affero General Public License version 3 (see the file LICENSE).
17 </div>
18 {% csrf_token %}
19 {% if next %}<input type="hidden" name="next" value="{{ next }}">{% endif %}
20- <button type="submit" class="p-button--positive u-no-margin--bottom" name="continue" data-qa-id="continue_button">{% trans "Continue" %}</button>
21- <a class="p-button--neutral p-link--external u-no-margin--bottom" data-qa-id="manage_devices_button" href={% url 'device-list' %} target="_blank">{% trans "Manage Devices" %}</a>
22+ <button type="submit" class="p-button--positive u-no-margin--bottom" name="continue" data-qa-id="continue_button">{% trans "Everything looks OK, continue" %}</button>
23+ <a class="p-link--external u-no-margin--bottom" style="padding-left: 1em" data-qa-id="manage_devices_button" href={% url 'device-list' %} target="_blank">{% trans "Manage Devices" %}</a>
24 </form>
25 </div>
26 {% else %}
27 <p>{% trans "You don't have any authentication devices associated with this account." %}</p>
28 {% endif %}
29- <div class="col-5 col-start-large-8">
30- <aside class="p-table-of-contents">
31- <h3 class="p-heading--four">{% trans "Other actions" %}</h3>
32- <ul class="p-list--divided">
33+ <div style="padding-top: 3em">
34+ <h3 class="p-heading--four">{% trans "Useful links" %}</h3>
35+ <ul class="p-list">
36 <li class="p-list__item"><a href="{% url 'device-help' %}">{% trans "Report a lost or stolen device" %}</a></li>
37 <li class="p-list__item">{% blocktrans with "twofactor_faq"|static_url as 2FFAQ %}<a href="{{ 2FFAQ }}">2-factor authentication FAQ</a>{% endblocktrans %}</li>
38 </ul>
39- </aside>
40 </div>
41 </div>
42 {% endblock %}
43diff --git a/src/webui/templates/registration/twofactor.html b/src/webui/templates/registration/twofactor.html
44index 83bfade..a638c24 100644
45--- a/src/webui/templates/registration/twofactor.html
46+++ b/src/webui/templates/registration/twofactor.html
47@@ -19,14 +19,12 @@
48 <div id="auth" class="col-6">
49 {% if form %}
50 {% if twofactor_nag %}
51- <div class="p-notification--caution">
52+ <div class="p-notification">
53 <p class="p-notification__response">
54- <span class="p-notification__status">{% trans "Did You Know?" %}</span>
55- {% trans "You can use one of the codes from your printed backup." %}
56- {% trans "Why not give it a try? This also helps ensure your backup codes are handy." %}
57- {% trans "If you prefer not to, you can use your primary device, and we will remind you again in a few weeks." %}
58- <br>
59 <br>
60+ <span class="p-notification__status">
61+ {% trans "Remember to always have your back up device at hand." %}
62+ </span>
63 {% if twofactor_last_nag %}
64 {% if backup_device_last_use and not multiple_devices %}
65 {% blocktrans with last_use=backup_device_last_use|timesince %}You haven't used your backup device in {{ last_use }}.{% endblocktrans %}
66@@ -80,6 +78,7 @@
67 {% endif %}
68 {% csrf_token %}
69 {% if next %}<input type="hidden" name="next" value="{{ next }}">{% endif %}
70+ <p class='p-form-help-text'>You can also use a code from your printed backup.</p>
71 <button type="submit" class="p-button--positive u-no-margin--bottom" name="continue" data-qa-id="auth_button">{% trans "Authenticate" %}</button>
72 </form>
73 </div>
74diff --git a/src/webui/tests/test_views_devices.py b/src/webui/tests/test_views_devices.py
75index d81a8b1..32e1661 100644
76--- a/src/webui/tests/test_views_devices.py
77+++ b/src/webui/tests/test_views_devices.py
78@@ -252,7 +252,7 @@ class DeviceVerifyViewTestCase(DeviceViewsTestCaseBase):
79 # Continue button is shown
80 buttons = tree.find("[name='continue']")
81 self.assertEqual(len(buttons), 1)
82- self.assertEqual(buttons[0].text, "Continue")
83+ self.assertEqual(buttons[0].text, "Everything looks OK, continue")
84
85 def test_device_list_device_never_used(self):
86 self.account.twofactor_required = True
87diff --git a/src/webui/tests/test_views_ui.py b/src/webui/tests/test_views_ui.py
88index 044d52f..54d9ac6 100644
89--- a/src/webui/tests/test_views_ui.py
90+++ b/src/webui/tests/test_views_ui.py
91@@ -2164,7 +2164,7 @@ class TwoFactorNagTestCase(BaseTwoFactorLoginTestCase):
92 r = self.client.get(reverse('twofactor'))
93 # Context should contain a directive to nag
94 self.assertTrue(r.context.get('twofactor_nag'))
95- self.assertContains(r, "backup codes")
96+ self.assertContains(r, "back up device at hand")
97
98 @switches(TWOFACTOR_BACKUP_NAG=True)
99 def test_check_view_does_not_nag_if_no_paper_backup(self):
100@@ -2179,8 +2179,8 @@ class TwoFactorNagTestCase(BaseTwoFactorLoginTestCase):
101 r = self.client.get(reverse('twofactor'))
102 # Context should NOT contain a directive to nag
103 self.assertFalse(r.context.get('twofactor_nag'))
104- # and response should not mention backup codes
105- self.assertNotContains(r, "backup codes")
106+ # and response should not mention backup device at hand
107+ self.assertNotContains(r, "back up device at hand")
108
109 def test_check_view_success_updates_last_nag_and_used_device(self):
110 # If the user has been nagged before and needs to be nagged again

Subscribers

People subscribed via source and target branches