Improve mail templates, and publish template.

- Fixes #74.
This commit is contained in:
Justus Winter 2019-03-11 17:02:45 +01:00
parent 7d115714a2
commit f3aa4e45a4
No known key found for this signature in database
GPG Key ID: 686F55B4AB2B3386
8 changed files with 83 additions and 12 deletions

View File

@ -5,6 +5,22 @@
<title>Please confirm deletion of your key</title>
</head>
<body>
<a href='https://{{ domain }}/vks/v1/confirm/{{ token }}'>Click here</a> to confirm deleting your key.
<p>
Someone, presumably you, requested that your key will no longer
be available when searching for you email addresses on
<a href="https://{{domain}}">{{domain}}</a>.
</p>
<p>
If it was not you, please ignore this email.
</p>
<p>
To de-list your key on {{domain}}, follow this link:
</p>
<p>
<a href="https://{{domain}}/vks/v1/confirm/{{token}}">https://{{domain}}/vks/v1/confirm/{{token}}</a>
</p>
<p>
If you do not want to de-list your key, please ignore this
email.
</body>
</html>

View File

@ -1 +1,10 @@
Click here: https://{{ domain }}/vks/v1/confirm/{{ token }} to confirm deleting of your key.
Someone, presumably you, requested that your key will no longer be
available when searching for you email addresses on {{domain}}.
If it was not you, please ignore this email.
To de-list your key on {{domain}}, follow this link:
https://{{domain}}/vks/v1/confirm/{{token}}
If you do not want to de-list your key, please ignore this email.

View File

@ -5,6 +5,28 @@
<title>Please verify your email address</title>
</head>
<body>
<a href='https://{{ domain }}/vks/v1/verify/{{ token }}'>Click here</a> to verify {{ address }}
<p>
Someone, presumably you, has uploaded a key
to <a href="https://{{domain}}">{{domain}}</a>. The key has the
following fingerprint:
</p>
<p>
<pre>{{primary_fp}}</pre>
</p>
<p>
If it was not you, or this is not your key, please ignore this
email.
</p>
<p>
To make your key available when searching for "{{userid}}" on
{{domain}}, follow this link:
</p>
<p>
<a href="https://{{domain}}/vks/v1/verify/{{token}}">https://{{domain}}/vks/v1/verify/{{token}}</a>
</p>
<p>
If you don't want to make the key available when searching for
"{{userid}}", please ignore this email.
</p>
</body>
</html>

View File

@ -1 +1,14 @@
Click here: https://{{ domain }}/vks/v1/verify/{{ token }} to verify {{ address }}
Someone, presumably you, has uploaded a key to {{domain}}.
The key has the following fingerprint:
{{primary_fp}}
If it was not you, or this is not your key, please ignore this email.
To make your key available when searching for "{{userid}}" on
{{domain}}, follow this link:
https://{{domain}}/vks/v1/verify/{{token}}
If you don't want to make the key available when searching for
"{{userid}}", please ignore this email.

View File

@ -1,8 +1,13 @@
{{#> layout }}
<h2>Verify Ok</h2>
<ul>
{{#each emails}}
<li>{{this}}</li>
{{/each}}
</ul>
<h2>Email verification required</h2>
<p>
We have sent verification emails to the following addresses:
<ul>
{{#each emails}}
<li>{{this}}</li>
{{/each}}
</ul>
To make the keys available when searching by address, you need to
follow the link sent to each address.
</p>
{{/layout}}

View File

@ -6,12 +6,15 @@ use lettre_email::EmailBuilder;
use serde::Serialize;
use sequoia_openpgp as openpgp;
use database::types::Email;
use Result;
mod context {
#[derive(Serialize, Clone)]
pub struct Verification {
pub primary_fp: String,
pub token: String,
pub userid: String,
pub domain: String,
@ -56,9 +59,11 @@ impl Service {
}
}
pub fn send_verification(&self, userid: &Email, token: &str, domain: &str)
pub fn send_verification(&self, tpk: &openpgp::TPK, userid: &Email,
token: &str, domain: &str)
-> Result<()> {
let ctx = context::Verification {
primary_fp: tpk.fingerprint().to_string(),
token: token.to_string(),
userid: userid.to_string(),
domain: domain.to_string(),

View File

@ -1065,7 +1065,7 @@ mod tests {
fn check_mails_and_confirm(client: &Client, filemail_path: &Path) {
let confirm_re =
regex::bytes::Regex::new("https://domain(/vks/v1/verify[^ \t]*)")
regex::bytes::Regex::new("https://domain(/vks/v1/verify[^ \t\n]*)")
.unwrap();
let confirm_mail = pop_mail(filemail_path).unwrap().unwrap();
let confirm_bytes = confirm_mail.message();

View File

@ -210,6 +210,7 @@ where
if let Some(ref mail_service) = mail_service {
for (email, token) in tokens {
mail_service.send_verification(
&tpk,
&email,
&token,
domain,