2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-04-29 12:06:44 +00:00

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
This commit is contained in:
Oliver 2022-06-17 11:33:45 +10:00 committed by GitHub
parent 50a4bda184
commit 0d01ea2f2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 49 additions and 21 deletions

View File

@ -39,7 +39,9 @@ for a account and sign in below:{% endblocktrans %}</p>
<div>{{ login_message | safe }}<hr></div> <div>{{ login_message | safe }}<hr></div>
{% endif %} {% endif %}
<div class="btn-group float-right" role="group"> <div class="btn-group float-right" role="group">
<button class="btn btn-success" type="submit">{% trans "Sign In" %}</button> <button class="btn btn-success" type="submit">
<span class='fas fa-sign-in-alt'></span> {% trans "Sign In" %}
</button>
</div> </div>
{% if mail_conf and enable_pwd_forgot %} {% if mail_conf and enable_pwd_forgot %}
<a class="" href="{% url 'account_reset_password' %}"><small>{% trans "Forgot Password?" %}</small></a> <a class="" href="{% url 'account_reset_password' %}"><small>{% trans "Forgot Password?" %}</small></a>

View File

@ -5,7 +5,7 @@
{% block head_title %}{% trans "Sign Out" %}{% endblock %} {% block head_title %}{% trans "Sign Out" %}{% endblock %}
{% block content %} {% block content %}
<h1>{% trans "Sign Out" %}</h1> <h3>{% trans "Sign Out" %}</h3>
<p>{% trans 'Are you sure you want to sign out?' %}</p> <p>{% trans 'Are you sure you want to sign out?' %}</p>
@ -16,10 +16,16 @@
{% endif %} {% endif %}
<hr> <hr>
<div class='btn-group float-right' role='group'> <div class='btn-group float-right' role='group'>
<a type='button' class='btn btn-secondary' href='{% url "index" %}'><span class='fas fa-undo-alt'></span> {% trans "Back to Site" %}</a> <button type="submit" class="btn btn-danger btn-block">
<button type="submit" class="btn btn-danger btn-block">{% trans 'Sign Out' %}</button> <span class='fas fa-sign-out-alt'></span> {% trans 'Sign Out' %}
</button>
</div> </div>
</form> </form>
<div>
<a type='button' class='btn btn-secondary' href='{% url "index" %}'>
<span class='fas fa-undo-alt'></span> {% trans "Return to Site" %}
</a>
</div>
{% endblock %} {% endblock %}

View File

@ -9,7 +9,7 @@
{{ form|crispy }} {{ form|crispy }}
<button type="submit" class="btn btn-primary"> <button type="submit" class="btn btn-primary">
{% trans 'Authenticate' %} <span class='fas fa-check-circle'></span> {% trans 'Authenticate' %}
</button> </button>
</form> </form>
{% endblock %} {% endblock %}

View File

@ -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.' %} {% trans 'Backup tokens have been generated, but are not revealed here for security reasons. Press the button below to generate new ones.' %}
{% endif %} {% endif %}
{% else %} {% 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 %} {% endif %}
<br> <hr>
<form method="post"> <form method="post">
{% csrf_token %} {% csrf_token %}
<button type="submit" class="btn btn-primary w-100"> <div class='btn-group float-right' role='group'>
{% trans 'Generate backup tokens' %} <button type="submit" class="btn btn-primary w-100">
</button> <span class='fas fa-key'></span> {% trans 'Generate Tokens' %}
</button>
</div>
</form> </form>
<br>
<a href="{% url 'settings' %}" class="btn btn-secondary w-100 btn-sm">{% trans "Back to settings" %}</a> <div>
<a type='button' href="{% url 'settings' %}" class="btn btn-secondary">
<span class='fas fa-undo-alt'></span> {% trans "Return to Site" %}
</a>
</div>
{% endblock %} {% endblock %}

View File

@ -1,5 +1,5 @@
{% extends "account/base.html" %} {% extends "account/base.html" %}
{% load i18n %} {% load i18n crispy_forms_tags %}
{% block content %} {% block content %}
<h3> <h3>
@ -10,9 +10,18 @@
<form method="post"> <form method="post">
{% csrf_token %} {% csrf_token %}
<button type="submit" class="btn btn-danger w-100"> {{ form|crispy }}
{% trans 'Disable Two-Factor' %} <hr>
</button> <div class='btn-group float-right' role='group'>
<button type="submit" class="btn btn-danger w-100">
<span class='fas fa-times-circle'></span> {% trans 'Disable 2FA' %}
</button>
</div>
</form> </form>
<div>
<a type='button' href="{% url 'settings' %}" class="btn btn-secondary">
<span class='fas fa-undo-alt'></span> {% trans "Return to Site" %}
</a>
</div>
{% endblock %} {% endblock %}

View File

@ -31,12 +31,17 @@
{% csrf_token %} {% csrf_token %}
{{ form|crispy }} {{ form|crispy }}
<button type="submit" class="btn btn-primary btn-block w-100"> <hr>
{% trans 'Verify' %} <div class='btn-group float-right' role='group'>
</button> <button type="submit" class="btn btn-primary btn-block w-100">
<span class='fas fa-check-circle'></span> {% trans 'Verify' %}
</button>
</div>
</form> </form>
<div> <div>
<a href="{% url 'settings' %}" class="btn btn-secondary w-100 btn-sm mt-3">{% trans "Back to settings" %}</a> <a type='button' href="{% url 'settings' %}" class="btn btn-secondary">
<span class='fas fa-undo-alt'></span> {% trans "Return to Site" %}
</a>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -8,7 +8,7 @@ coveralls==2.1.2 # Coveralls linking (for Travis)
cryptography==3.4.8 # Cryptography support cryptography==3.4.8 # Cryptography support
django-admin-shell==0.1.2 # Python shell for the admin interface 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==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-cleanup==5.1.0 # Manage deletion of old / unused uploaded files
django-cors-headers==3.2.0 # CORS headers extension for DRF django-cors-headers==3.2.0 # CORS headers extension for DRF
django-crispy-forms==1.11.2 # Form helpers django-crispy-forms==1.11.2 # Form helpers