From 85da98a004ef84f2a57c295fa398d38ccc60081e Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 31 Oct 2021 23:07:25 +0100 Subject: [PATCH] use auth screen to make more clear this is about security --- .../templates/allauth_2fa/authenticate.html | 15 ++++++++ .../templates/allauth_2fa/backup_tokens.html | 32 +++++++++++++++++ InvenTree/templates/allauth_2fa/remove.html | 18 ++++++++++ InvenTree/templates/allauth_2fa/setup.html | 36 +++++++++++++++++++ 4 files changed, 101 insertions(+) create mode 100644 InvenTree/templates/allauth_2fa/authenticate.html create mode 100644 InvenTree/templates/allauth_2fa/backup_tokens.html create mode 100644 InvenTree/templates/allauth_2fa/remove.html create mode 100644 InvenTree/templates/allauth_2fa/setup.html diff --git a/InvenTree/templates/allauth_2fa/authenticate.html b/InvenTree/templates/allauth_2fa/authenticate.html new file mode 100644 index 0000000000..1a392fc44a --- /dev/null +++ b/InvenTree/templates/allauth_2fa/authenticate.html @@ -0,0 +1,15 @@ +{% extends "account/base.html" %} +{% load i18n crispy_forms_tags %} + +{% block content %} +

{% trans "Two-Factor Authentication" %}

+ +
+ {% csrf_token %} + {{ form|crispy }} + + +
+{% endblock %} diff --git a/InvenTree/templates/allauth_2fa/backup_tokens.html b/InvenTree/templates/allauth_2fa/backup_tokens.html new file mode 100644 index 0000000000..fcb6a35914 --- /dev/null +++ b/InvenTree/templates/allauth_2fa/backup_tokens.html @@ -0,0 +1,32 @@ +{% extends "account/base.html" %} +{% load i18n %} + +{% block content %} +

+ {% trans "Two-Factor Authentication Backup Tokens" %} +

+ +{% if backup_tokens %} + {% if reveal_tokens %} + + {% else %} + {% trans 'Backup tokens have been generated, but are not revealed here for security reasons. Press the button below to generate new ones.' %} + {% endif %} +{% else %} + {% trans 'No tokens. Press the button below to generate some.' %} +{% endif %} + +
+ {% csrf_token %} + +
+ +Disable Two Factor + +{% endblock %} diff --git a/InvenTree/templates/allauth_2fa/remove.html b/InvenTree/templates/allauth_2fa/remove.html new file mode 100644 index 0000000000..dd45ad19ea --- /dev/null +++ b/InvenTree/templates/allauth_2fa/remove.html @@ -0,0 +1,18 @@ +{% extends "account/base.html" %} +{% load i18n %} + +{% block content %} +

+ {% trans "Disable Two-Factor Authentication" %} +

+ +

{% trans "Are you sure?" %}

+ +
+ {% csrf_token %} + +
+ +{% endblock %} diff --git a/InvenTree/templates/allauth_2fa/setup.html b/InvenTree/templates/allauth_2fa/setup.html new file mode 100644 index 0000000000..46d2f3a55c --- /dev/null +++ b/InvenTree/templates/allauth_2fa/setup.html @@ -0,0 +1,36 @@ +{% extends "account/base.html" %} +{% load i18n %} + +{% block content %} +

+ {% trans "Setup Two-Factor Authentication" %} +

+ +

+ {% trans 'Step 1' %}: +

+ +

+ {% trans 'Scan the QR code below with a token generator of your choice (for instance Google Authenticator).' %} +

+ + + +

+ {% trans 'Step 2' %}: +

+ +

+ {% trans 'Input a token generated by the app:' %} +

+ +
+ {% csrf_token %} + {{ form.non_field_errors }} + {{ form.token.label }}: {{ form.token }} + + +
+{% endblock %}