core: Format email templates.

This commit is contained in:
Teffen Ellis
2025-04-17 02:00:56 +02:00
parent 61bc89959b
commit 037ef3a2a0
6 changed files with 182 additions and 156 deletions

View File

@ -4,41 +4,43 @@
{% load humanize %} {% load humanize %}
{% block content %} {% block content %}
<tr> <tr>
<td align="center"> <td align="center">
<h1> <h1>
{% blocktrans with username=user.username %} {% blocktrans with username=user.username %}
Hi {{ username }}, Hi {{ username }},
{% endblocktrans %} {% endblocktrans %}
</h1> </h1>
</td> </td>
</tr> </tr>
<tr>
<td align="center"> <tr>
<table border="0"> <td align="center">
<tr> <table border="0">
<td align="center" style="max-width: 300px; padding: 20px 0; color: #212124;"> <tr>
{% blocktrans %} <td align="center" style="max-width: 300px; padding: 20px 0; color: #212124;">
Email MFA code. {% blocktrans %}
{% endblocktrans %} Email MFA code.
</td> {% endblocktrans %}
</tr> </td>
<tr> </tr>
<td align="center" class="btn btn-primary">
{{ token }} <tr>
</td> <td align="center" class="btn btn-primary">
</tr> {{ token }}
</table> </td>
</td> </tr>
</tr> </table>
</td>
</tr>
{% endblock %} {% endblock %}
{% block sub_content %} {% block sub_content %}
<tr> <tr>
<td style="padding: 20px; font-size: 12px; color: #212124;" align="center"> <td style="padding: 20px; font-size: 12px; color: #212124;" align="center">
{% blocktrans with expires=expires|timeuntil %} {% blocktrans with expires=expires|timeuntil %}
If you did not request this code, please ignore this email. The code above is valid for {{ expires }}. If you did not request this code, please ignore this email. The code above is valid for {{ expires }}.
{% endblocktrans %} {% endblocktrans %}
</td> </td>
</tr> </tr>
{% endblock %} {% endblock %}

View File

@ -4,38 +4,47 @@
{% load i18n %} {% load i18n %}
{% block content %} {% block content %}
<tr> <tr>
<td align="center"> <td align="center">
<h1> <h1>
{% trans 'Welcome!' %} {% trans 'Welcome!' %}
</h1> </h1>
</td> </td>
</tr> </tr>
<tr>
<td align="center"> <tr>
<table border="0"> <td align="center">
<tr> <table border="0">
<td align="center" style="max-width: 300px; padding: 20px 0; color: #212124;"> <tr>
{% trans "We're excited to have you get started. First, you need to confirm your account. Just press the button below."%} <td align="center" style="max-width: 300px; padding: 20px 0; color: #212124;">
</td> {% trans "We're excited to have you get started. First, you need to confirm your account. Just press the button below."%}
</tr> </td>
<tr> </tr>
<td align="center" class="btn btn-primary">
<a id="confirm" href="{{ url }}" rel="noopener noreferrer" target="_blank">{% trans 'Confirm Account' %}</a> <tr>
</td> <td align="center" class="btn btn-primary">
</tr> <a
</table> id="confirm"
</td> href="{{ url }}"
</tr> rel="noopener noreferrer"
<td> target="_blank">
{% trans 'Confirm Account' %}
</a>
</td>
</tr>
</table>
</td>
</tr>
<td>
{% endblock %} {% endblock %}
{% block sub_content %} {% block sub_content %}
<tr> <tr>
<td style="padding: 20px; font-size: 12px; color: #212124;word-break: break-all; overflow-wrap: break-word;" align="center"> <td style="padding: 20px; font-size: 12px; color: #212124;word-break: break-all; overflow-wrap: break-word;" align="center">
{% blocktrans with url=url %} {% blocktrans with url=url %}
If that doesn't work, copy and paste the following link in your browser: {{ url }} If that doesn't work, copy and paste the following link in your browser: {{ url }}
{% endblocktrans %} {% endblocktrans %}
</td> </td>
</tr> </tr>
{% endblock %} {% endblock %}

View File

@ -1,5 +1,6 @@
{% load authentik_stages_email %} {% load authentik_stages_email %}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtm=l"> <html xmlns="http://www.w3.org/1999/xhtm=l">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
@ -99,11 +100,13 @@
<img src="{% block logo_url %}cid:logo.png{% endblock %}" border="0=" alt="authentik logo" class="flexibleImage logo"> <img src="{% block logo_url %}cid:logo.png{% endblock %}" border="0=" alt="authentik logo" class="flexibleImage logo">
</td> </td>
</tr> </tr>
{% block content %} {% block content %}
{% endblock %} {% endblock %}
</table> </table>
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>
<table border="0" style="margin-top: 10px;" width="100%"> <table border="0" style="margin-top: 10px;" width="100%">
@ -118,6 +121,7 @@
</table> </table>
</td> </td>
</tr> </tr>
<tr> <tr>
<td align="center"> <td align="center">
Powered by <a rel="noopener noreferrer" target="_blank" href="https://goauthentik.io?utm_source=authentik&utm_medium=email">authentik</a>. Powered by <a rel="noopener noreferrer" target="_blank" href="https://goauthentik.io?utm_source=authentik&utm_medium=email">authentik</a>.

View File

@ -3,50 +3,52 @@
{% load i18n %} {% load i18n %}
{% block content %} {% block content %}
<tr> <tr>
<td align="center"> <td align="center">
<h1> <h1>
{{ title }} {{ title }}
</h1> </h1>
</td> </td>
</tr> </tr>
<tr>
<td align="center"> <tr>
<table border="0"> <td align="center">
<tr> <table border="0">
<td align="center" style="max-width: 300px; padding: 20px 0; color: #212124;"> <tr>
{{ body }} <td align="center" style="max-width: 300px; padding: 20px 0; color: #212124;">
</td> {{ body }}
</tr> </td>
{% if key_value %} </tr>
<tr>
<td> {% if key_value %}
<table class="properties-table" width="100%"> <tr>
<tbody> <td>
{% for key, value in key_value.items %} <table class="properties-table" width="100%">
<tr> <tbody>
<td class="td-right">{{ key }}</td> {% for key, value in key_value.items %}
<td class="td-left">{{ value }}</td> <tr>
</tr> <td class="td-right">{{ key }}</td>
{% endfor %} <td class="td-left">{{ value }}</td>
</tbody> </tr>
</table> {% endfor %}
</td> </tbody>
</tr> </table>
{% endif %} </td>
</table> </tr>
</td> {% endif %}
</tr> </table>
</td>
</tr>
{% endblock %} {% endblock %}
{% block sub_content %} {% block sub_content %}
{% if source %} {% if source %}
<tr> <tr>
<td style="padding: 20px; font-size: 12px; color: #212124;" align="center"> <td style="padding: 20px; font-size: 12px; color: #212124;" align="center">
{% blocktranslate with name=source.from %} {% blocktranslate with name=source.from %}
This email was sent from the notification transport <code>{{ name }}</code>. This email was sent from the notification transport <code>{{ name }}</code>.
{% endblocktranslate %} {% endblocktranslate %}
</td> </td>
</tr> </tr>
{% endif %} {% endif %}
{% endblock %} {% endblock %}

View File

@ -4,41 +4,49 @@
{% load humanize %} {% load humanize %}
{% block content %} {% block content %}
<tr> <tr>
<td align="center"> <td align="center">
<h1> <h1>
{% blocktrans with username=user.username %} {% blocktrans with username=user.username %}
Hi {{ username }}, Hi {{ username }},
{% endblocktrans %} {% endblocktrans %}
</h1> </h1>
</td> </td>
</tr> </tr>
<tr>
<td align="center"> <tr>
<table border="0"> <td align="center">
<tr> <table border="0">
<td align="center" style="max-width: 300px; padding: 20px 0; color: #212124;"> <tr>
{% blocktrans %} <td align="center" style="max-width: 300px; padding: 20px 0; color: #212124;">
You recently requested to change your password for your authentik account. Use the button below to set a new password. {% blocktrans %}
{% endblocktrans %} You recently requested to change your password for your authentik account. Use the button below to set a new password.
</td> {% endblocktrans %}
</tr> </td>
<tr> </tr>
<td align="center" class="btn btn-primary">
<a id="confirm" href="{{ url }}" rel="noopener noreferrer" target="_blank">{% trans 'Reset Password' %}</a> <tr>
</td> <td align="center" class="btn btn-primary">
</tr> <a
</table> id="confirm"
</td> href="{{ url }}"
</tr> rel="noopener noreferrer"
target="_blank">
{% trans 'Reset Password' %}
</a>
</td>
</tr>
</table>
</td>
</tr>
{% endblock %} {% endblock %}
{% block sub_content %} {% block sub_content %}
<tr> <tr>
<td style="padding: 20px; font-size: 12px; color: #212124;" align="center"> <td style="padding: 20px; font-size: 12px; color: #212124;" align="center">
{% blocktrans with expires=expires|naturaltime %} {% blocktrans with expires=expires|naturaltime %}
If you did not request a password change, please ignore this email. The link above is valid for {{ expires }}. If you did not request a password change, please ignore this email. The link above is valid for {{ expires }}.
{% endblocktrans %} {% endblocktrans %}
</td> </td>
</tr> </tr>
{% endblock %} {% endblock %}

View File

@ -4,22 +4,23 @@
{% load i18n %} {% load i18n %}
{% block content %} {% block content %}
<tr> <tr>
<td class="alert alert-brand"> <td class="alert alert-brand">
{% trans 'authentik Test-Email' %} {% trans 'authentik Test-Email' %}
</td> </td>
</tr> </tr>
<tr>
<tr>
<td class="content-wrap"> <td class="content-wrap">
<table width="100%" cellpadding="0" cellspacing="0"> <table width="100%" cellpadding="0" cellspacing="0">
<tr> <tr>
<td class="content-block"> <td class="content-block">
{% blocktrans %} {% blocktrans %}
This is a test email to inform you, that you've successfully configured authentik emails. This is a test email to inform you, that you've successfully configured authentik emails.
{% endblocktrans %} {% endblocktrans %}
</td> </td>
</tr> </tr>
</table> </table>
</td> </td>
</tr> </tr>
{% endblock %} {% endblock %}