From 0d01ea2f2e9d1780604a22c78f34b55f330c9648 Mon Sep 17 00:00:00 2001 From: Oliver Date: Fri, 17 Jun 2022 11:33:45 +1000 Subject: [PATCH] Auth forms fix (#3214) * Improvement and consolidation of various auth forms * Update "disable 2FA" page to use form fields Note: Requires merging of https://github.com/valohai/django-allauth-2fa/pull/135 * Update django-allauth-2fa requirements --- InvenTree/templates/account/login.html | 4 +++- InvenTree/templates/account/logout.html | 12 ++++++++--- .../templates/allauth_2fa/authenticate.html | 2 +- .../templates/allauth_2fa/backup_tokens.html | 20 ++++++++++++------- InvenTree/templates/allauth_2fa/remove.html | 17 ++++++++++++---- InvenTree/templates/allauth_2fa/setup.html | 13 ++++++++---- requirements.txt | 2 +- 7 files changed, 49 insertions(+), 21 deletions(-) diff --git a/InvenTree/templates/account/login.html b/InvenTree/templates/account/login.html index 042c119440..0572a4c4d8 100644 --- a/InvenTree/templates/account/login.html +++ b/InvenTree/templates/account/login.html @@ -39,7 +39,9 @@ for a account and sign in below:{% endblocktrans %}

{{ login_message | safe }}
{% endif %}
- +
{% if mail_conf and enable_pwd_forgot %} {% trans "Forgot Password?" %} diff --git a/InvenTree/templates/account/logout.html b/InvenTree/templates/account/logout.html index df37c76be4..37df8d7577 100644 --- a/InvenTree/templates/account/logout.html +++ b/InvenTree/templates/account/logout.html @@ -5,7 +5,7 @@ {% block head_title %}{% trans "Sign Out" %}{% endblock %} {% block content %} -

{% trans "Sign Out" %}

+

{% trans "Sign Out" %}

{% trans 'Are you sure you want to sign out?' %}

@@ -16,10 +16,16 @@ {% endif %}
- {% trans "Back to Site" %} - +
+
+ + {% trans "Return to Site" %} + +
{% endblock %} diff --git a/InvenTree/templates/allauth_2fa/authenticate.html b/InvenTree/templates/allauth_2fa/authenticate.html index 1a392fc44a..b27b5df81c 100644 --- a/InvenTree/templates/allauth_2fa/authenticate.html +++ b/InvenTree/templates/allauth_2fa/authenticate.html @@ -9,7 +9,7 @@ {{ form|crispy }} {% endblock %} diff --git a/InvenTree/templates/allauth_2fa/backup_tokens.html b/InvenTree/templates/allauth_2fa/backup_tokens.html index 2257baecb3..fac32e3e2c 100644 --- a/InvenTree/templates/allauth_2fa/backup_tokens.html +++ b/InvenTree/templates/allauth_2fa/backup_tokens.html @@ -17,17 +17,23 @@ {% 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.' %} + {% trans 'No backup tokens are available. Press the button below to generate some.' %} {% endif %} -
+
{% csrf_token %} - +
+ +
-
-{% trans "Back to settings" %} + +
+ + {% trans "Return to Site" %} + +
{% endblock %} diff --git a/InvenTree/templates/allauth_2fa/remove.html b/InvenTree/templates/allauth_2fa/remove.html index fb9d15ae32..aab3915fa8 100644 --- a/InvenTree/templates/allauth_2fa/remove.html +++ b/InvenTree/templates/allauth_2fa/remove.html @@ -1,5 +1,5 @@ {% extends "account/base.html" %} -{% load i18n %} +{% load i18n crispy_forms_tags %} {% block content %}

@@ -10,9 +10,18 @@
{% csrf_token %} - + {{ form|crispy }} +
+
+ +
+
+ + {% trans "Return to Site" %} + +
{% endblock %} diff --git a/InvenTree/templates/allauth_2fa/setup.html b/InvenTree/templates/allauth_2fa/setup.html index 2b74ad9c47..027cef905d 100644 --- a/InvenTree/templates/allauth_2fa/setup.html +++ b/InvenTree/templates/allauth_2fa/setup.html @@ -31,12 +31,17 @@ {% csrf_token %} {{ form|crispy }} - +
+
+ +
-{% trans "Back to settings" %} + + {% trans "Return to Site" %} +
{% endblock %} diff --git a/requirements.txt b/requirements.txt index 26bfca213b..765c774284 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,7 +8,7 @@ coveralls==2.1.2 # Coveralls linking (for Travis) cryptography==3.4.8 # Cryptography support django-admin-shell==0.1.2 # Python shell for the admin interface django-allauth==0.45.0 # SSO for external providers via OpenID -django-allauth-2fa==0.8 # MFA / 2FA +django-allauth-2fa==0.9 # MFA / 2FA django-cleanup==5.1.0 # Manage deletion of old / unused uploaded files django-cors-headers==3.2.0 # CORS headers extension for DRF django-crispy-forms==1.11.2 # Form helpers