Skip to content

Commit 03af9b6

Browse files
authored
fix: add missing page for /accounts/2fa/authenticate/ (#110)
1 parent eb9e843 commit 03af9b6

File tree

3 files changed

+40
-1
lines changed

3 files changed

+40
-1
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{% extends "mfa/authenticate.html" %}
2+
{% load allauth %}
3+
{% load allauth_ui %}
4+
{% load i18n %}
5+
{% block content %}
6+
{% trans "Two-Factor Authentication" as heading %}
7+
{% blocktranslate asvar subheading %}Your account is protected by two-factor authentication. Please enter an authenticator code:{% endblocktranslate %}
8+
{% url 'mfa_authenticate' as action_url %}
9+
{% #container heading=heading subheading=subheading %}
10+
{% translate "Activate" as button_text %}
11+
{% trans "Sign In" as button_text %}
12+
{% #form form=form url=action_url button_text=button_text %}
13+
{% csrf_token %}
14+
{% /form %}
15+
{% if "webauthn" in MFA_SUPPORTED_TYPES %}
16+
<div class="divider"></div>
17+
<h2 class="my-3 text-lg">{% translate "Alternative options" %}</h2>
18+
{% #form form=webauthn_form url=action_url use_default_button="false" %}
19+
<button type="submit" class="btn btn-neutral">{% trans "Use a security key" %}</button>
20+
<a href="{% url "account_login" %}" class="btn btn-accent">{% trans "Cancel" %}</a>
21+
{% csrf_token %}
22+
{% /form %}
23+
{% endif %}
24+
{% /container %}
25+
{{ js_data|json_script:"js_data" }}
26+
{% include "mfa/webauthn/snippets/scripts.html" %}
27+
{# djlint:off #}
28+
<script type="text/javascript">
29+
allauth.webauthn.forms.authenticateForm({
30+
ids: {
31+
authenticate: "mfa_webauthn_authenticate",
32+
credential: "{{ webauthn_form.credential.auto_id }}"
33+
},
34+
data: JSON.parse(document.getElementById('js_data').textContent)
35+
})
36+
</script>
37+
{# djlint:on #}
38+
{% endblock content %}

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
44

55
[tool.poetry]
66
name = "django-allauth-ui"
7-
version = "1.3.1"
7+
version = "1.3.1b2"
88
description = ""
99
authors = ["Dani Hodovic <you@example.com>"]
1010
license = "MIT"

tests/settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,3 +119,4 @@
119119
USERSESSIONS_TRACK_ACTIVITY = True
120120

121121
MFA_SUPPORTED_TYPES = ["totp", "webauthn", "recovery_codes"]
122+
MFA_TOTP_ISSUER = "AllAuth UI"

0 commit comments

Comments
 (0)