2FA: Implement emergency tokens

This commit is contained in:
Raphael Michel
2016-10-08 15:16:42 +02:00
parent 68a9f98f23
commit 582d9dca25
6 changed files with 72 additions and 2 deletions

View File

@@ -11,7 +11,7 @@
</p>
<p>
{% trans "You will no longer be able to log in to pretix without one of your configured devices." %}
{% trans "Please make sure to print out or copy the emergency keys and store them in a safe place." %}
{% trans "Please make sure to print out or copy the emergency tokens and store them in a safe place." %}
</p>
<div class="form-group submit-group">
<a href="{% url "control:user.settings.2fa" %}" class="btn btn-default btn-cancel">

View File

@@ -71,4 +71,24 @@
</li>
</ul>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">{% trans "Emergency tokens" %}</h3>
</div>
<div class="panel-body">
<p>
{% trans "If you lose access to your devices, you can use one of the following keys to log in. We recommend to store them in a safe place, e.g. printed out or in a password manager. Every token can be used at most once." %}
</p>
<p>{% trans "Unused tokens:" %}</p>
<ul>
{% for t in static_tokens %}
<li><code>{{ t.token }}</code></li>
{% endfor %}
</ul>
<a href="{% url "control:user.settings.2fa.regenemergency" %}" class="btn btn-default">
<span class="fa fa-refresh"></span>
{% trans "Generate new emergency tokens" %}
</a>
</div>
</div>
{% endblock %}

View File

@@ -0,0 +1,24 @@
{% extends "pretixcontrol/base.html" %}
{% load i18n %}
{% load bootstrap3 %}
{% block title %}{% trans "Regenerate emergency codes" %}{% endblock %}
{% block content %}
<h1>{% trans "Regenerate emergency codes" %}</h1>
<form action="" method="post" class="form-horizontal">
{% csrf_token %}
<p>
{% trans "Do you really want to regenerate your emergency codes?" %}
</p>
<p>
{% trans "The old codes will no longer work." %}
</p>
<div class="form-group submit-group">
<a href="{% url "control:user.settings.2fa" %}" class="btn btn-default btn-cancel">
{% trans "Cancel" %}
</a>
<button type="submit" class="btn btn-danger btn-save">
{% trans "Regenerate" %}
</button>
</div>
</form>
{% endblock %}