stages/email: update default email templates

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-04-04 13:26:35 +02:00
parent 97ea859315
commit b8c41f54c5
3 changed files with 52 additions and 40 deletions

View File

@ -8,11 +8,7 @@ from rest_framework.viewsets import ModelViewSet
from authentik.core.api.utils import TypeCreateSerializer from authentik.core.api.utils import TypeCreateSerializer
from authentik.flows.api.stages import StageSerializer from authentik.flows.api.stages import StageSerializer
from authentik.stages.email.models import ( from authentik.stages.email.models import EmailStage, get_template_choices
EmailStage,
EmailTemplates,
get_template_choices,
)
class EmailStageSerializer(StageSerializer): class EmailStageSerializer(StageSerializer):
@ -23,6 +19,7 @@ class EmailStageSerializer(StageSerializer):
self.fields["template"].choices = get_template_choices() self.fields["template"].choices = get_template_choices()
def validate_template(self, value: str) -> str: def validate_template(self, value: str) -> str:
"""Check validity of template"""
choices = get_template_choices() choices = get_template_choices()
for path, _ in choices: for path, _ in choices:
if path == value: if path == value:

View File

@ -61,7 +61,6 @@ body {
.main { .main {
background-color: #fff; background-color: #fff;
border: 1px solid #e9e9e9; border: 1px solid #e9e9e9;
border-radius: 3px;
} }
.content-wrap { .content-wrap {
@ -153,10 +152,13 @@ a {
text-align: center; text-align: center;
cursor: pointer; cursor: pointer;
display: inline-block; display: inline-block;
border-radius: 5px;
text-transform: capitalize; text-transform: capitalize;
} }
.btn-primary a {
color: #fff;
}
/* ------------------------------------- /* -------------------------------------
OTHER STYLES THAT MIGHT BE USEFUL OTHER STYLES THAT MIGHT BE USEFUL
------------------------------------- */ ------------------------------------- */
@ -194,7 +196,6 @@ a {
font-weight: 500; font-weight: 500;
padding: 20px; padding: 20px;
text-align: center; text-align: center;
border-radius: 3px 3px 0 0;
} }
.alert a { .alert a {
color: #fff; color: #fff;

View File

@ -4,17 +4,25 @@
{% load humanize %} {% load humanize %}
{% block content %} {% block content %}
<td> <tr>
<h2> <td class="alert alert-success">
{% blocktrans with username=user.username %} {% blocktrans with username=user.username %}
Hi {{ username }}, Hi {{ username }},
{% endblocktrans %} {% endblocktrans %}
</h2> </td>
<p> </tr>
<tr>
<td class="content-wrap">
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td class="content-block">
{% blocktrans %} {% blocktrans %}
You recently requested to change your password for you authentik account. Use the button below to set a new password. You recently requested to change your password for you authentik account. Use the button below to set a new password.
{% endblocktrans %} {% endblocktrans %}
</p> </td>
</tr>
<tr>
<td class="content-block">
<table role="presentation" border="0" cellpadding="0" cellspacing="0" class="btn btn-primary"> <table role="presentation" border="0" cellpadding="0" cellspacing="0" class="btn btn-primary">
<tbody> <tbody>
<tr> <tr>
@ -30,10 +38,16 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
<p> </td>
</tr>
<tr>
<td class="content-block">
{% 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 %}
</p>
</td> </td>
</tr>
</table>
</td>
</tr>
{% endblock %} {% endblock %}