Skip to content

Commit 1de7807

Browse files
committed
add templates for request and confirm login code
1 parent 8827d1e commit 1de7807

File tree

3 files changed

+55
-0
lines changed

3 files changed

+55
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{# -*- engine:django -*- #}
2+
{% extends "account/confirm_login_code.html" %}
3+
4+
{% load i18n %}
5+
{% load allauth %}
6+
{% load allauth_ui %}
7+
{% load widget_tweaks %}
8+
{% block content %}
9+
10+
{% trans "Sign In" as heading %}
11+
{% #container heading=heading %}
12+
<div class="py-3">
13+
{% blocktranslate %}Enter Sign-In Code{% endblocktranslate %}
14+
</div>
15+
<div class="py-3">
16+
{% setvar email_link %}
17+
<a href="mailto:{{ email }}">{{ email }}</a>
18+
{% endsetvar %}
19+
{% blocktranslate %}We’ve sent a code to {{ email_link }}. The code expires shortly, so please enter it soon.{% endblocktranslate %}
20+
</div>
21+
{% url 'account_confirm_login_code' as action_url %}
22+
{% #form form=form url=action_url button_text=heading %}
23+
{{ redirect_field }}
24+
{% csrf_token %}
25+
{% /form %}
26+
<button type="submit" class="btn btn-red" form="logout-from-stage">
27+
{% translate "Cancel" %}
28+
</button>
29+
<form id="logout-from-stage"
30+
method="post"
31+
action="{% url 'account_logout' %}">
32+
<input type="hidden" name="next" value="{% url 'account_login' %}">
33+
{% csrf_token %}
34+
</form>
35+
{% /container %}
36+
{% endblock content %}
37+
{% comment %}{% endcomment %}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{% extends "account/request_login_code.html" %}
2+
{% load i18n %}
3+
{% load allauth_ui %}
4+
{% load widget_tweaks %}
5+
{% block content %}
6+
{% trans "Mail me a sign-in code" as heading %}
7+
{% #container heading=heading %}
8+
<div class="py-3">
9+
{% blocktranslate %}You will receive an email containing a special code for a password-free sign-in.{% endblocktranslate %}
10+
</div>
11+
{% url 'account_request_login_code' as action_url %}
12+
{% #form form=form url=action_url button_text=heading %}
13+
{{ redirect_field }}
14+
{% csrf_token %}
15+
{% /form %}
16+
{% /container %}
17+
{% endblock content %}

tests/settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@
111111
ACCOUNT_EMAIL_VERIFICATION = "mandatory"
112112
ACCOUNT_AUTHENTICATION_METHOD = "email"
113113
ACCOUNT_LOGIN_ATTEMPTS_LIMIT = 1000
114+
ACCOUNT_LOGIN_BY_CODE_ENABLED = "true"
114115

115116
BASE_DIR = Path(__file__).parent.parent
116117

0 commit comments

Comments
 (0)