-
-
Notifications
You must be signed in to change notification settings - Fork 447
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the possibility for the user to change the double authenticaiton …
…method he uses
- Loading branch information
1 parent
1d6d964
commit 59f4bc7
Showing
24 changed files
with
1,220 additions
and
59 deletions.
There are no files selected for viewing
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,15 @@ | ||
{% load i18n %} | ||
|
||
{% if cancel_url %} | ||
<a href="{{ cancel_url }}" | ||
class="pull-right btn btn-link">{% trans "Cancel" %}</a> | ||
{% endif %} | ||
{% if wizard.steps.prev %} | ||
<button name="wizard_goto_step" type="submit" | ||
value="{{ wizard.steps.prev }}" | ||
class="btn btn-default">{% trans "Back" %}</button> | ||
{% else %} | ||
<button disabled name="" type="button" | ||
class="btn btn-disabled">{% trans "Back" %}</button> | ||
{% endif %} | ||
<button type="submit" class="btn btn-primary">{% trans "Next" %}</button> |
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,28 @@ | ||
{% extends "two_factor/_base_focus.html" %} | ||
{% load i18n %} | ||
|
||
{% block content %} | ||
<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> | ||
|
||
{% 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> | ||
{% else %} | ||
<p>{% trans "You don't have any backup codes yet." %}</p> | ||
{% endif %} | ||
|
||
<form method="post">{% csrf_token %}{{ form }} | ||
<a href="{% url 'two_factor:profile'%}" | ||
class="pull-right btn btn-link">{% trans "Back to Account Security" %}</a> | ||
<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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
{% extends "two_factor/_base_focus.html" %} | ||
{% load i18n two_factor %} | ||
|
||
{% block content %} | ||
<h1>{% block title %}{% trans "Login" %}{% endblock %}</h1> | ||
|
||
{% if wizard.steps.current == 'auth' %} | ||
<p>{% blocktrans %}Enter your credentials.{% endblocktrans %}</p> | ||
{% elif wizard.steps.current == 'token' %} | ||
{% 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> | ||
{% else %} | ||
<p>{% blocktrans trimmed %}Please enter the tokens generated by your token | ||
generator.{% endblocktrans %}</p> | ||
{% endif %} | ||
{% elif wizard.steps.current == 'backup' %} | ||
<p>{% blocktrans trimmed %}Use this form for entering backup tokens for logging in. | ||
These tokens have been generated for you to print and keep safe. Please | ||
enter one of these backup tokens to login 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 #} | ||
<div style="margin-left: -9999px"><input type="submit" value=""/></div> | ||
|
||
{% if other_devices %} | ||
<p>{% trans "Or, alternatively, use one of your backup phones:" %}</p> | ||
<p> | ||
{% for other in other_devices %} | ||
<button name="challenge_device" value="{{ other.persistent_id }}" | ||
class="btn btn-default btn-block" type="submit"> | ||
{{ other|device_action }} | ||
</button> | ||
{% endfor %}</p> | ||
{% endif %} | ||
{% if backup_tokens %} | ||
<p>{% trans "As a last resort, you can use a backup token:" %}</p> | ||
<p> | ||
<button name="wizard_goto_step" type="submit" value="backup" | ||
class="btn btn-default btn-block">{% trans "Use Backup Token" %}</button> | ||
</p> | ||
{% endif %} | ||
|
||
{% include "two_factor/_wizard_actions.html" %} | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{% extends "two_factor/_base_focus.html" %} | ||
{% load i18n %} | ||
|
||
{% block content %} | ||
<h1>{% block title %}{% trans "Permission Denied" %}{% endblock %}</h1> | ||
|
||
<p>{% blocktrans trimmed %}The page you requested, enforces users to verify using | ||
two-factor authentication for security reasons. You need to enable these | ||
security features in order to access this page.{% endblocktrans %}</p> | ||
|
||
<p>{% blocktrans trimmed %}Two-factor authentication is not enabled for your | ||
account. Enable two-factor authentication for enhanced account | ||
security.{% endblocktrans %}</p> | ||
<p> | ||
<a href="javascript:history.go(-1)" | ||
class="pull-right btn btn-link">{% trans "Go back" %}</a> | ||
<a href="{% url 'two_factor:setup' %}" class="btn btn-primary"> | ||
{% trans "Enable Two-Factor Authentication" %}</a> | ||
</p> | ||
{% 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{% extends "two_factor/_base_focus.html" %} | ||
{% load i18n %} | ||
|
||
{% block content %} | ||
<h1>{% block title %}{% trans "Add Backup Phone" %}{% endblock %}</h1> | ||
|
||
{% if wizard.steps.current == 'setup' %} | ||
<p>{% blocktrans trimmed %}You'll be adding a backup phone number to your | ||
account. This number will be used if your primary method of | ||
registration is not available.{% endblocktrans %}</p> | ||
{% elif wizard.steps.current == 'validation' %} | ||
<p>{% blocktrans trimmed %}We've sent a token to your phone number. Please | ||
enter the token you've received.{% endblocktrans %}</p> | ||
{% endif %} | ||
|
||
<form action="" method="post">{% csrf_token %} | ||
{% include "two_factor/_wizard_forms.html" %} | ||
|
||
{# hidden submit button to enable [enter] key #} | ||
<div style="margin-left: -9999px"><input type="submit" value=""/></div> | ||
|
||
{% include "two_factor/_wizard_actions.html" %} | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
{% extends "two_factor/_base_focus.html" %} | ||
{% load i18n %} | ||
{% block content %} | ||
<h1>{% block title %}{% trans "Enable Two-Factor Authentication" %}{% endblock %}</h1> | ||
{% if wizard.steps.current == 'welcome' %} | ||
<p>{% blocktrans trimmed %}You are about to take your account security to the | ||
next level. Follow the steps in this wizard 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" /></p> | ||
{% 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 #} | ||
<div style="margin-left: -9999px"><input type="submit" value=""/></div> | ||
|
||
{% include "two_factor/_wizard_actions.html" %} | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{% extends "two_factor/_base_focus.html" %} | ||
{% load i18n %} | ||
|
||
{% block content %} | ||
<h1>{% block title %}{% trans "Enable Two-Factor Authentication" %}{% endblock %}</h1> | ||
|
||
<p>{% blocktrans trimmed %}Congratulations, you've successfully enabled two-factor | ||
authentication.{% endblocktrans %}</p> | ||
|
||
{% if not phone_methods %} | ||
<p><a href="{% url 'two_factor:profile' %}" | ||
class="btn btn-block btn-default">{% trans "Back to Profile" %}</a></p> | ||
{% 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> | ||
|
||
<a href="{% url 'two_factor:profile' %}" | ||
class="pull-right btn btn-link">{% trans "Back to Profile" %}</a> | ||
<p><a href="{% url 'two_factor:phone_create' %}" | ||
class="btn btn-success">{% trans "Add Phone Number" %}</a></p> | ||
{% endif %} | ||
|
||
{% endblock %} |
28 changes: 28 additions & 0 deletions
28
example/templates/two_factor/core/setup_reset_generator_or_yubikey.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,28 @@ | ||
{% extends "two_factor/_base_focus.html" %} | ||
{% load i18n %} | ||
|
||
{% block content %} | ||
<h1>{% block title %}{% trans "Change Two-Factor Authentication method" %}{% endblock %}</h1> | ||
{% if 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" /></p> | ||
{% 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 #} | ||
<div style="margin-left: -9999px"><input type="submit" value=""/></div> | ||
|
||
{% include "two_factor/_wizard_actions.html" %} | ||
</form> | ||
{% endblock %} |
49 changes: 49 additions & 0 deletions
49
example/templates/two_factor/core/setup_reset_phone_or_generator.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,49 @@ | ||
{% extends "two_factor/_base_focus.html" %} | ||
{% load i18n %} | ||
|
||
{% block content %} | ||
<h1>{% block title %}{% trans "Change Two-Factor Authentication method" %}{% endblock %}</h1> | ||
|
||
{% if 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" /></p> | ||
{% 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 %} | ||
{% endif %} | ||
|
||
<form action="" method="post">{% csrf_token %} | ||
{% include "two_factor/_wizard_forms.html" %} | ||
|
||
{# hidden submit button to enable [enter] key #} | ||
<div style="margin-left: -9999px"><input type="submit" value=""/></div> | ||
|
||
{% include "two_factor/_wizard_actions.html" %} | ||
</form> | ||
{% endblock %} |
45 changes: 45 additions & 0 deletions
45
example/templates/two_factor/core/setup_reset_phone_or_yubikey.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,45 @@ | ||
{% extends "two_factor/_base_focus.html" %} | ||
{% load i18n %} | ||
{% block content %} | ||
<h1>{% block title %}{% trans "Change Two-Factor Authentication method" %}{% endblock %}</h1> | ||
{% if wizard.steps.current == 'method' %} | ||
<p>{% blocktrans trimmed %}Please select which authentication method you would | ||
like to use.{% endblocktrans %}</p> | ||
{% 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 #} | ||
<div style="margin-left: -9999px"><input type="submit" value=""/></div> | ||
|
||
{% include "two_factor/_wizard_actions.html" %} | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{% extends "two_factor/_base_focus.html" %} | ||
{% load i18n %} | ||
|
||
{% block content %} | ||
<h1>{% block title %}{% trans "Disable Two-factor Authentication" %}{% endblock %}</h1> | ||
<p>{% blocktrans trimmed %}You are about to disable two-factor authentication. This | ||
weakens your account security, are you sure?{% endblocktrans %}</p> | ||
<form method="post"> | ||
{% csrf_token %} | ||
<table>{{ form }}</table> | ||
<button class="btn btn-danger" | ||
type="submit">{% trans "Disable" %}</button> | ||
</form> | ||
{% endblock %} |
Oops, something went wrong.