Skip to content

Commit ef83eb3

Browse files
authored
add templates for request and confirm login code (#134)
* add templates for request and confirm login code * djlint reformat
1 parent 8827d1e commit ef83eb3

File tree

3 files changed

+49
-0
lines changed

3 files changed

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