Skip to content

Commit

Permalink
add templates for request and confirm login code
Browse files Browse the repository at this point in the history
  • Loading branch information
yhager committed Feb 11, 2025
1 parent 8827d1e commit 1de7807
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 0 deletions.
37 changes: 37 additions & 0 deletions allauth_ui/templates/account/confirm_login_code.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{# -*- engine:django -*- #}
{% extends "account/confirm_login_code.html" %}

{% load i18n %}
{% load allauth %}
{% load allauth_ui %}
{% load widget_tweaks %}
{% block content %}

{% trans "Sign In" as heading %}
{% #container heading=heading %}
<div class="py-3">
{% blocktranslate %}Enter Sign-In Code{% endblocktranslate %}
</div>
<div class="py-3">
{% setvar email_link %}
<a href="mailto:{{ email }}">{{ email }}</a>
{% endsetvar %}
{% blocktranslate %}We’ve sent a code to {{ email_link }}. The code expires shortly, so please enter it soon.{% endblocktranslate %}
</div>
{% url 'account_confirm_login_code' as action_url %}
{% #form form=form url=action_url button_text=heading %}
{{ redirect_field }}
{% csrf_token %}
{% /form %}
<button type="submit" class="btn btn-red" form="logout-from-stage">
{% translate "Cancel" %}
</button>
<form id="logout-from-stage"
method="post"
action="{% url 'account_logout' %}">
<input type="hidden" name="next" value="{% url 'account_login' %}">
{% csrf_token %}
</form>
{% /container %}
{% endblock content %}
{% comment %}{% endcomment %}
17 changes: 17 additions & 0 deletions allauth_ui/templates/account/request_login_code.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{% extends "account/request_login_code.html" %}
{% load i18n %}
{% load allauth_ui %}
{% load widget_tweaks %}
{% block content %}
{% trans "Mail me a sign-in code" as heading %}
{% #container heading=heading %}
<div class="py-3">
{% blocktranslate %}You will receive an email containing a special code for a password-free sign-in.{% endblocktranslate %}
</div>
{% url 'account_request_login_code' as action_url %}
{% #form form=form url=action_url button_text=heading %}
{{ redirect_field }}
{% csrf_token %}
{% /form %}
{% /container %}
{% endblock content %}
1 change: 1 addition & 0 deletions tests/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@
ACCOUNT_EMAIL_VERIFICATION = "mandatory"
ACCOUNT_AUTHENTICATION_METHOD = "email"
ACCOUNT_LOGIN_ATTEMPTS_LIMIT = 1000
ACCOUNT_LOGIN_BY_CODE_ENABLED = "true"

BASE_DIR = Path(__file__).parent.parent

Expand Down

0 comments on commit 1de7807

Please sign in to comment.