feat(templating): add and use templates for /magic and emails

This commit is contained in:
Edouard Vanbelle
2026-06-03 13:35:51 +02:00
parent 044bd76738
commit 854f1d3a07
11 changed files with 570 additions and 216 deletions
+7
View File
@@ -0,0 +1,7 @@
{{ body }}
{%- if let Some(en) = english_fallback %}
{{ divider }}
{{ en }}
{%- endif %}
@@ -0,0 +1,23 @@
<!doctype html>
<html lang="{{ locale_code }}">
<head>
<meta charset="utf-8">
<title>OxiCloud</title>
<style>
body { font-family: system-ui, sans-serif; max-width: 520px; margin: 6em auto;
padding: 0 1em; color: #333; line-height: 1.5; }
h1 { font-size: 1.4em; }
.btn { display: inline-block; padding: .7em 1.4em; background: #2563eb; color: #fff;
border-radius: 6px; text-decoration: none; font-weight: 600; margin-top: 1em; }
.btn:hover { background: #1d4ed8; }
.note { background: #fef3c7; border-left: 3px solid #f59e0b;
padding: .75em 1em; margin: 1.5em 0; border-radius: 4px; font-size: .95em; }
</style>
</head>
<body>
<h1>{{ title }}</h1>
<p>{{ body }}</p>
<p class="note">{{ warning }}</p>
<p><a class="btn" href="{{ confirm_url }}">{{ continue_label }}</a></p>
</body>
</html>
@@ -0,0 +1,29 @@
<!doctype html>
<html lang="{{ locale_code }}">
<head>
<meta charset="utf-8">
<title>OxiCloud</title>
<style>
body { font-family: system-ui, sans-serif; max-width: 560px; margin: 6em auto;
padding: 0 1em; color: #333; line-height: 1.5; }
h1 { font-size: 1.4em; }
.btn { display: inline-block; padding: .7em 1.4em; background: #2563eb; color: #fff;
border-radius: 6px; text-decoration: none; font-weight: 600; margin-top: .4em;
border: 0; cursor: pointer; font-size: 1em; }
.btn:hover { background: #1d4ed8; }
.muted { color: #666; font-size: .9em; margin-top: 2em; }
</style>
</head>
<body>
<h1>{{ title }}</h1>
{%- if let Some(offer) = resend %}
<p>{{ body }}</p>
<form method="post" action="{{ offer.action_url }}">
<button type="submit" class="btn">{{ offer.button_label }}</button>
</form>
{%- else %}
<p>{{ body }}</p>
{%- endif %}
<p class="muted"><a href="/">{{ return_link }}</a></p>
</body>
</html>
@@ -0,0 +1,18 @@
<!doctype html>
<html lang="{{ locale_code }}">
<head>
<meta charset="utf-8">
<title>OxiCloud</title>
<style>
body { font-family: system-ui, sans-serif; max-width: 640px; margin: 6em auto;
padding: 0 1em; color: #333; }
h1 { font-size: 1.4em; }
p { line-height: 1.5; }
</style>
</head>
<body>
<h1>{{ title }}</h1>
<p>{{ body }}</p>
<p><a href="/">{{ return_link }}</a></p>
</body>
</html>
@@ -0,0 +1,18 @@
<!doctype html>
<html lang="{{ locale_code }}">
<head>
<meta charset="utf-8">
<title>OxiCloud</title>
<style>
body { font-family: system-ui, sans-serif; max-width: 560px; margin: 6em auto;
padding: 0 1em; color: #333; line-height: 1.5; }
h1 { font-size: 1.4em; }
.muted { color: #666; font-size: .9em; margin-top: 2em; }
</style>
</head>
<body>
<h1>{{ title }}</h1>
<p>{{ body }}</p>
<p class="muted"><a href="/">{{ return_link }}</a></p>
</body>
</html>