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.flows.api.stages import StageSerializer
from authentik.stages.email.models import (
EmailStage,
EmailTemplates,
get_template_choices,
)
from authentik.stages.email.models import EmailStage, get_template_choices
class EmailStageSerializer(StageSerializer):
@ -23,6 +19,7 @@ class EmailStageSerializer(StageSerializer):
self.fields["template"].choices = get_template_choices()
def validate_template(self, value: str) -> str:
"""Check validity of template"""
choices = get_template_choices()
for path, _ in choices:
if path == value:

View file

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

View file

@ -4,36 +4,50 @@
{% load humanize %}
{% block content %}
<td>
<h2>
{% blocktrans with username=user.username %}
Hi {{ username }},
{% endblocktrans %}
</h2>
<p>
{% blocktrans %}
You recently requested to change your password for you authentik account. Use the button below to set a new password.
{% endblocktrans %}
</p>
<table role="presentation" border="0" cellpadding="0" cellspacing="0" class="btn btn-primary">
<tbody>
<tr>
<td align="center">
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td> <a id="confirm" href="{{ url }}" rel="noopener noreferrer" target="_blank">{% trans 'Reset Password' %}</a> </td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<p>
{% blocktrans with expires=expires|naturaltime %}
If you did not request a password change, please ignore this Email. The link above is valid for {{ expires }}.
{% endblocktrans %}
</p>
</td>
<tr>
<td class="alert alert-success">
{% blocktrans with username=user.username %}
Hi {{ username }},
{% endblocktrans %}
</td>
</tr>
<tr>
<td class="content-wrap">
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td class="content-block">
{% blocktrans %}
You recently requested to change your password for you authentik account. Use the button below to set a new password.
{% endblocktrans %}
</td>
</tr>
<tr>
<td class="content-block">
<table role="presentation" border="0" cellpadding="0" cellspacing="0" class="btn btn-primary">
<tbody>
<tr>
<td align="center">
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td> <a id="confirm" href="{{ url }}" rel="noopener noreferrer" target="_blank">{% trans 'Reset Password' %}</a> </td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td class="content-block">
{% blocktrans with expires=expires|naturaltime %}
If you did not request a password change, please ignore this Email. The link above is valid for {{ expires }}.
{% endblocktrans %}
</td>
</tr>
</table>
</td>
</tr>
{% endblock %}