-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Improve 2FA workflow usability
- Loading branch information
Showing
18 changed files
with
231 additions
and
44 deletions.
There are no files selected for viewing
13 changes: 10 additions & 3 deletions
13
hypha/apply/users/templates/two_factor/_wizard_actions.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,15 @@ | ||
{% load i18n %} | ||
|
||
<button type="submit" class="button button--primary">{% trans "Next" %}</button> | ||
{% if wizard.steps.current == 'token' %} | ||
{% trans "Login" as button_text %} | ||
{% elif wizard.steps.current == 'generator' %} | ||
{% trans "Enable Two-Factor Authentication" as button_text %} | ||
{% else %} | ||
{% trans "Next" as button_text %} | ||
{% endif %} | ||
|
||
<button type="submit" class="button button--primary">{{ button_text }}</button> | ||
|
||
{% if cancel_url %} | ||
<a href="{% url 'users:account' %}" | ||
class="link link--bold link--left-space">{% trans "Cancel" %}</a> | ||
<a href="{% url 'users:account' %}" class="link link--bold link--left-space">{% trans "Cancel" %}</a> | ||
{% endif %} |
30 changes: 17 additions & 13 deletions
30
hypha/apply/users/templates/two_factor/core/backup_tokens.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,32 @@ | ||
{% extends "two_factor/_base_focus.html" %} | ||
{% load i18n %} | ||
{% load i18n users_tags %} | ||
|
||
{% block content %} | ||
<p><a href="{% url 'two_factor:profile'%}" | ||
class="btn btn-link">{% trans "Back" %}</a></p> | ||
<h1>{% block title %}{% trans "Backup Tokens" %}{% endblock %}</h1> | ||
<p>{% blocktrans trimmed %}Backup tokens can be used when your primary and backup | ||
phone numbers aren't available. The backup tokens below can be used | ||
for login verification. If you've used up all your backup tokens, you | ||
can generate a new set of backup tokens. Only the backup tokens shown | ||
below will be valid.{% endblocktrans %}</p> | ||
<p><a href="{% url 'users:account'%}" | ||
class="btn btn-link">{% trans "Back to account" %}</a></p> | ||
<h1>{% block title %}{% trans "Backup Codes" %}{% endblock %}</h1> | ||
<p>{% blocktrans trimmed %}These codes should be kept in a safe, | ||
private place for when you need them. When they are used up, | ||
you can generate a new set of backup codes.{% endblocktrans %}</p> | ||
|
||
{% if device.token_set.count %} | ||
<ul> | ||
{% for token in device.token_set.all %} | ||
<li>{{ token.token }}</li> | ||
{% endfor %} | ||
</ul> | ||
<p>{% blocktrans %}Print these tokens and keep them somewhere safe.{% endblocktrans %}</p> | ||
<p>{% blocktrans %}You should now download, or print these codes, | ||
and keep them somewhere safe.{% endblocktrans %}</p> | ||
<form method="post">{% csrf_token %}{{ form }} | ||
<button class="btn btn-primary" type="submit">{% trans "Regenerate Codes" %}</button> | ||
<a class="btn btn-link link--left-space" href="data:text/plain;charset=UTF-8,{% tokens_text device.token_set.all %}" download="backup_codes.txt"> | ||
{% trans "Save Codes" %}</a> | ||
</form> | ||
{% else %} | ||
<p>{% trans "You don't have any backup codes yet." %}</p> | ||
<form method="post">{% csrf_token %}{{ form }} | ||
<button class="btn btn-primary" type="submit">{% trans "Generate Codes" %}</button> | ||
</form> | ||
{% endif %} | ||
|
||
<form method="post">{% csrf_token %}{{ form }} | ||
<button class="btn btn-primary" type="submit">{% trans "Generate Tokens" %}</button> | ||
</form> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
{% extends "two_factor/_base_focus.html" %} | ||
{% load i18n %} | ||
|
||
{% block content %} | ||
<h1>{% block title %}{% trans "Two-Factor Authentication (2FA)" %}{% endblock %}</h1> | ||
{% if wizard.steps.current == 'welcome' %} | ||
<p>{% blocktrans trimmed %}You are about to take your account security to the | ||
next level.{% endblocktrans %}</p> | ||
<p>{% blocktrans trimmed %}To start using 2FA, you need to install an Authenticator app on your smartphone or computer. With Safari on Apple devices you can also use a built in system.{% endblocktrans %}</p> | ||
<p>{% blocktrans trimmed %}Install the app you choose then continue to Enable Two-Factor Authentication. {% endblocktrans %}</p> | ||
{% elif wizard.steps.current == 'method' %} | ||
<p>{% blocktrans trimmed %}Please select which authentication method you would | ||
like to use.{% endblocktrans %}</p> | ||
{% elif wizard.steps.current == 'generator' %} | ||
<p>{% blocktrans trimmed %}To start using a token generator, please use your | ||
smartphone to scan the QR code below. For example, use Google | ||
Authenticator. Then, enter the token generated by the app. | ||
{% endblocktrans %}</p> | ||
<p><img src="{{ QR_URL }}" alt="QR Code" class="bg-white" width="200" height="200" /></p> | ||
<details> | ||
<summary>Advanced</summary> | ||
<p>For advanced users, here is the otpauth url in string format.</p> | ||
<p><a href="{{ otpauth_url }}">{{ otpauth_url }}</a></p> | ||
</details> | ||
{% elif wizard.steps.current == 'sms' %} | ||
<p>{% blocktrans trimmed %}Please enter the phone number you wish to receive the | ||
text messages on. This number will be validated in the next step. | ||
{% endblocktrans %}</p> | ||
{% elif wizard.steps.current == 'call' %} | ||
<p>{% blocktrans trimmed %}Please enter the phone number you wish to be called on. | ||
This number will be validated in the next step. {% endblocktrans %}</p> | ||
{% elif wizard.steps.current == 'validation' %} | ||
{% if challenge_succeeded %} | ||
{% if device.method == 'call' %} | ||
<p>{% blocktrans trimmed %}We are calling your phone right now, please enter the | ||
digits you hear.{% endblocktrans %}</p> | ||
{% elif device.method == 'sms' %} | ||
<p>{% blocktrans trimmed %}We sent you a text message, please enter the tokens we | ||
sent.{% endblocktrans %}</p> | ||
{% endif %} | ||
{% else %} | ||
<p class="alert alert-warning" role="alert">{% blocktrans trimmed %}We've | ||
encountered an issue with the selected authentication method. Please | ||
go back and verify that you entered your information correctly, try | ||
again, or use a different authentication method instead. If the issue | ||
persists, contact the site administrator.{% endblocktrans %}</p> | ||
{% endif %} | ||
{% elif wizard.steps.current == 'yubikey' %} | ||
<p>{% blocktrans trimmed %}To identify and verify your YubiKey, please insert a | ||
token in the field below. Your YubiKey will be linked to your | ||
account.{% endblocktrans %}</p> | ||
{% endif %} | ||
|
||
<form action="" method="post">{% csrf_token %} | ||
{% include "two_factor/_wizard_forms.html" %} | ||
|
||
{# hidden submit button to enable [enter] key #} | ||
<input type="submit" value="" class="d-none" /> | ||
|
||
{% include "two_factor/_wizard_actions.html" %} | ||
</form> | ||
{% endblock %} |
25 changes: 25 additions & 0 deletions
25
hypha/apply/users/templates/two_factor/core/setup_complete.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{% extends "two_factor/_base_focus.html" %} | ||
{% load i18n %} | ||
|
||
{% block content %} | ||
<h1>{% block title %}{% trans "Two-Factor Authentication(2FA)" %}{% endblock %}</h1> | ||
|
||
<p>{% blocktrans trimmed %}Congratulations, you've successfully enabled two-factor | ||
authentication.{% endblocktrans %}</p> | ||
<p>{% blocktrans trimmed %}We strongly recommend you to save the backup codes. | ||
To get the backup codes you can continue to Show Codes.{% endblocktrans %}</p> | ||
|
||
{% if not phone_methods %} | ||
<a href="{% url 'users:backup_tokens_password' %}" class="btn btn-link">Show Codes</a> | ||
<a href="{% url 'users:account' %}" class="link link--bold link--left-space">{% trans "Back to Account" %}</a> | ||
{% else %} | ||
<p>{% blocktrans trimmed %}However, it might happen that you don't have access to | ||
your primary token device. To enable account recovery, add a phone | ||
number.{% endblocktrans %}</p> | ||
|
||
<p><a href="{% url 'users:backup_tokens_password' %}" class="btn btn-block">Show Codes</a></p> | ||
<p><a href="{% url 'two_factor:phone_create' %}" | ||
class="btn btn-success">{% trans "Add Phone Number" %}</a></p> | ||
{% endif %} | ||
|
||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.