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>
{% endif %}
<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>
{% if mail_conf and enable_pwd_forgot %}
<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 content %}
<h1>{% trans "Sign Out" %}</h1>
<h3>{% trans "Sign Out" %}</h3>
<p>{% trans 'Are you sure you want to sign out?' %}</p>
@ -16,10 +16,16 @@
{% endif %}
<hr>
<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">{% trans 'Sign Out' %}</button>
<button type="submit" class="btn btn-danger btn-block">
<span class='fas fa-sign-out-alt'></span> {% trans 'Sign Out' %}
</button>
</div>
</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 %}

View File

@ -9,7 +9,7 @@
{{ form|crispy }}
<button type="submit" class="btn btn-primary">
{% trans 'Authenticate' %}
<span class='fas fa-check-circle'></span> {% trans 'Authenticate' %}
</button>
</form>
{% 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.' %}
{% 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 %}
<br>
<hr>
<form method="post">
{% csrf_token %}
<button type="submit" class="btn btn-primary w-100">
{% trans 'Generate backup tokens' %}
</button>
<div class='btn-group float-right' role='group'>
<button type="submit" class="btn btn-primary w-100">
<span class='fas fa-key'></span> {% trans 'Generate Tokens' %}
</button>
</div>
</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 %}

View File

@ -1,5 +1,5 @@
{% extends "account/base.html" %}
{% load i18n %}
{% load i18n crispy_forms_tags %}
{% block content %}
<h3>
@ -10,9 +10,18 @@
<form method="post">
{% csrf_token %}
<button type="submit" class="btn btn-danger w-100">
{% trans 'Disable Two-Factor' %}
</button>
{{ form|crispy }}
<hr>
<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>
<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 %}

View File

@ -31,12 +31,17 @@
{% csrf_token %}
{{ form|crispy }}
<button type="submit" class="btn btn-primary btn-block w-100">
{% trans 'Verify' %}
</button>
<hr>
<div class='btn-group float-right' role='group'>
<button type="submit" class="btn btn-primary btn-block w-100">
<span class='fas fa-check-circle'></span> {% trans 'Verify' %}
</button>
</div>
</form>
<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>
{% endblock %}

View File

@ -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