1
0
mirror of https://github.com/pocket-id/pocket-id.git synced 2026-02-15 18:05:05 +00:00

fix: emails do not get rendered correctly in Gmail

This commit is contained in:
Elias Schneider
2025-02-19 13:54:36 +01:00
parent 816c198a42
commit dca9e7a11a
2 changed files with 126 additions and 125 deletions

View File

@@ -1,95 +1,92 @@
{{ define "style" }} {{ define "style" }}
<style> <style>
body { /* Reset styles for email clients */
font-family: Arial, sans-serif; body, table, td, p, a {
background-color: #f0f0f0; margin: 0;
color: #333; padding: 0;
margin: 0; border: 0;
padding: 0; font-size: 100%;
} font-family: Arial, sans-serif;
.container { line-height: 1.5;
background-color: #fff; }
color: #333; body {
padding: 32px; background-color: #f0f0f0;
border-radius: 10px; color: #333;
max-width: 600px; }
margin: 40px auto; .container {
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); width: 100%;
} max-width: 600px;
.header { margin: 40px auto;
display: flex; background-color: #fff;
justify-content: space-between; border-radius: 10px;
align-items: center; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
margin-bottom: 24px; padding: 32px;
} }
.header .logo { .header {
display: flex; display: flex;
align-items: center; margin-bottom: 24px;
gap: 8px; }
} .header .logo img {
.header .logo img { width: 32px;
width: 32px; height: 32px;
height: 32px; vertical-align: middle;
object-fit: cover; }
} .header h1 {
.header h1 { font-size: 1.5rem;
font-size: 1.5rem; font-weight: bold;
font-weight: bold; display: inline-block;
} vertical-align: middle;
.warning { margin-left: 8px;
background-color: #ffd966; }
color: #7f6000; .warning {
padding: 4px 12px; background-color: #ffd966;
border-radius: 50px; color: #7f6000;
font-size: 0.875rem; padding: 4px 12px;
} border-radius: 50px;
.content { font-size: 0.875rem;
background-color: #fafafa; margin: auto 0 auto auto;
color: #333; }
padding: 24px; .content {
border-radius: 10px; background-color: #fafafa;
} padding: 24px;
.content h2 { border-radius: 10px;
font-size: 1.25rem; }
font-weight: bold; .content h2 {
margin-bottom: 16px; font-size: 1.25rem;
} font-weight: bold;
.grid { margin-bottom: 16px;
display: grid; }
grid-template-columns: 1fr 1fr; .grid {
gap: 16px; width: 100%;
margin-bottom: 16px; margin-bottom: 16px;
} }
.grid div { .grid td {
display: flex; width: 50%;
flex-direction: column; padding-bottom: 8px;
} vertical-align: top;
.grid p { }
margin: 0; .label {
} color: #888;
.label { font-size: 0.875rem;
color: #888; }
font-size: 0.875rem; .message {
margin-bottom: 4px; font-size: 1rem;
} line-height: 1.5;
.message { margin-top: 16px;
font-size: 1rem; }
line-height: 1.5; .button {
} background-color: #000000;
.button { color: #ffffff;
border-radius: 0.375rem; padding: 0.7rem 1.5rem;
font-size: 1rem; text-decoration: none;
font-weight: 500; border-radius: 4px;
background-color: #000000; font-size: 1rem;
color: #ffffff; font-weight: 500;
padding: 0.7rem 1.5rem; display: inline-block;
outline: none; margin-top: 24px;
border: none; }
text-decoration: none; .button-container {
} text-align: center;
.button-container { }
text-align: center;
margin-top: 24px;
}
</style> </style>
{{ end }} {{ end }}

View File

@@ -1,36 +1,40 @@
{{ define "base" }} {{ define "base" }}
<div class="header"> <div class="header">
<div class="logo"> <div class="logo">
<img src="{{ .LogoURL }}" alt="{{ .AppName }}"/> <img src="{{ .LogoURL }}" alt="{{ .AppName }}"/>
<h1>{{ .AppName }}</h1> <h1>{{ .AppName }}</h1>
</div> </div>
<div class="warning">Warning</div> <div class="warning">Warning</div>
</div> </div>
<div class="content"> <div class="content">
<h2>New Sign-In Detected</h2> <h2>New Sign-In Detected</h2>
<div class="grid"> <table class="grid">
{{ if and .Data.City .Data.Country }} <tr>
<div> {{ if and .Data.City .Data.Country }}
<p class="label">Approximate Location</p> <td>
<p>{{ .Data.City }}, {{ .Data.Country }}</p> <p class="label">Approximate Location</p>
</div> <p>{{ .Data.City }}, {{ .Data.Country }}</p>
{{ end }} </td>
<div> {{ end }}
<p class="label">IP Address</p> <td>
<p>{{ .Data.IPAddress }}</p> <p class="label">IP Address</p>
</div> <p>{{ .Data.IPAddress }}</p>
<div> </td>
<p class="label">Device</p> </tr>
<p>{{ .Data.Device }}</p> <tr>
</div> <td>
<div> <p class="label">Device</p>
<p class="label">Sign-In Time</p> <p>{{ .Data.Device }}</p>
<p>{{ .Data.DateTime.Format "2006-01-02 15:04:05 UTC" }}</p> </td>
</div> <td>
</div> <p class="label">Sign-In Time</p>
<p class="message"> <p>{{ .Data.DateTime.Format "2006-01-02 15:04:05 UTC" }}</p>
This sign-in was detected from a new device or location. If you recognize this activity, you can </td>
safely ignore this message. If not, please review your account and security settings. </tr>
</p> </table>
</div> <p class="message">
This sign-in was detected from a new device or location. If you recognize this activity, you can
safely ignore this message. If not, please review your account and security settings.
</p>
</div>
{{ end -}} {{ end -}}