Skip to content

Commit

Permalink
Journalist Interface: Show additional informations for reset buttons
Browse files Browse the repository at this point in the history
Shows explanatory text using tooltips above the buttons in Reset
authenticator buttons thus reducing the button label texts.
  • Loading branch information
SaptakS committed Apr 17, 2018
1 parent 84f2fd9 commit d0918f2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
9 changes: 4 additions & 5 deletions securedrop/journalist_templates/edit_account.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ <h2>{{ gettext('Reset Two-Factor Authentication') }}</h2>
{% set hotp_reset_url = url_for('account.reset_two_factor_hotp') %}
{% endif %}

{% macro twofa_reset(user, reset_url, type, button_text) %}
{% macro twofa_reset(user, reset_url, type, tooltip_text, button_text) %}
{% if user %}
{% set username = user.username %}
{% else %}
Expand All @@ -83,12 +83,11 @@ <h2>{{ gettext('Reset Two-Factor Authentication') }}</h2>
<input name="uid" type="hidden" value="{{ user.id }}">
{% endif %}
<input name="csrf_token" type="hidden" value="{{ csrf_token() }}">
<button class="sd-button" id="button-reset-two-factor-{{ type }}" type="submit" class="pull-right"><i class="fas fa-sync"></i> {{ button_text }}</button>
<button class="sd-button" id="button-reset-two-factor-{{ type }}" tooltip="{{ tooltip_text }}" type="submit" class="pull-right"><i class="fas fa-sync"></i> {{ button_text }}</button>
</form>
{%- endmacro %}

{{ twofa_reset(user, totp_reset_url, "totp", gettext("RESET TWO-FACTOR AUTHENTICATION (APP)"))}}
<br>
{{ twofa_reset(user, hotp_reset_url, "hotp", gettext("RESET TWO-FACTOR AUTHENTICATION (HARDWARE TOKEN)"))}}
{{ twofa_reset(user, totp_reset_url, "totp", gettext("Reset 2FA for mobile apps such as FreeOTP or Google Authenticator"), gettext("RESET APP TOKEN"))}}
{{ twofa_reset(user, hotp_reset_url, "hotp", gettext("Reset 2FA for hardware tokens like Yubikey"), gettext("RESET HARDWARE TOKEN"))}}

{% endblock %}
3 changes: 3 additions & 0 deletions securedrop/sass/_base.sass
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
@import modules/text-link
// Some kind of button possibly sd=standard button. Belongs in button module?
@import modules/sd-button
// Tooltips for showing informations
@import modules/tooltip
//variation on button for select all / none. In journalist interface only?
@import modules/select
// Pull - Quick layout helper classes
Expand Down Expand Up @@ -115,6 +117,7 @@
+doc-check
+text-link
+sd-button
+tooltip
+select
+pull
+header
Expand Down
3 changes: 3 additions & 0 deletions securedrop/sass/journalist.sass
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,6 @@ button.small-danger, a.btn.small-danger, .btn.small-danger

.journalist-reply__input
max-width: 700px

.reset-two-factor
display: inline-block

0 comments on commit d0918f2

Please sign in to comment.