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