From 1e1f17aceb653b5f60bd6734c1e98b3d35bd4a99 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sun, 1 Aug 2021 12:32:13 +0200 Subject: [PATCH] website/docs: add example Email template closes #1204 Signed-off-by: Jens Langhammer --- website/docs/flow/stages/email/index.md | 69 +++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/website/docs/flow/stages/email/index.md b/website/docs/flow/stages/email/index.md index 836d82c8f..281b027ce 100644 --- a/website/docs/flow/stages/email/index.md +++ b/website/docs/flow/stages/email/index.md @@ -21,3 +21,72 @@ If you've add the line and created a file, and can't see if, check the logs usin ::: ![](custom_template.png) + +### Example template + +Templates are rendered using Django's templating engine. The following variables can be used: + +- `url`: The full URL for the user to click on +- `user`: The pending user object. +- `expires`: The timestamp when the token expires. + +```html +{# This is how you can write comments which aren't rendered. #} + +{# Extend this template from the base email template, which includes base layout and CSS. #} +{% extends "email/base.html" %} + +{# Load the internationalization module to translate strings, and humanize to show date-time #} +{% load i18n %} +{% load humanize %} + +{# The email/base.html template uses a single "content" block #} +{% block content %} + + + {% blocktrans with username=user.username %} + Hi {{ username }}, + {% endblocktrans %} + + + + + + + + + + + + + + +
+ {% blocktrans %} + You recently requested to change your password for you authentik account. Use the button below to set a new password. + {% endblocktrans %} +
+ + + + + + + +
+ {% 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 %} +
+ + +{% endblock %} +```