mirror of
https://gitlab.com/hagrid-keyserver/hagrid.git
synced 2023-02-13 20:55:02 -05:00
hkp: drop "upload" mails
This commit is contained in:
parent
7011245414
commit
a7b4eec1fe
4 changed files with 0 additions and 97 deletions
26
dist/email-templates/upload.htm.hbs
vendored
26
dist/email-templates/upload.htm.hbs
vendored
|
@ -1,26 +0,0 @@
|
|||
<!doctype html>
|
||||
<html lang="{{lang}}">
|
||||
<head>
|
||||
<meta charset=utf-8>
|
||||
<title>Your key upload on {{domain}}</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
Hi,
|
||||
<p>
|
||||
This is an automated message from <a href="{{base_uri}}" style="text-decoration:none; color: #333">{{domain}}</a>.
|
||||
If you didn't upload your key there, please ignore this message.
|
||||
<p>
|
||||
OpenPGP key: <tt>{{primary_fp}}</tt>
|
||||
<p>
|
||||
This key was just uploaded to keys.openpgp.org. If you want to allow others to find this key by e-mail address, please follow this link:
|
||||
<p>
|
||||
<a rel="nofollow" href="{{uri}}">{{uri}}</a>
|
||||
<p>
|
||||
You can find more info at <a href="{{base_uri}}/about">{{domain}}/about</a>.
|
||||
<p>
|
||||
<a href="{{base_uri}}">{{base_uri}}</a><br />
|
||||
distributing OpenPGP keys since 2019
|
||||
</body>
|
||||
</html>
|
||||
|
18
dist/email-templates/upload.txt.hbs
vendored
18
dist/email-templates/upload.txt.hbs
vendored
|
@ -1,18 +0,0 @@
|
|||
Hi,
|
||||
|
||||
This is an automated message from {{domain}}.
|
||||
If you didn't upload your key, please ignore this message.
|
||||
|
||||
OpenPGP key: {{primary_fp}}
|
||||
|
||||
This key was just uploaded to keys.openpgp.org. If you want to allow
|
||||
others to find this key by e-mail address, please follow this link:
|
||||
|
||||
{{uri}}
|
||||
|
||||
You can find more info at {{base_uri}}/about
|
||||
|
||||
--
|
||||
|
||||
{{ base_uri }}
|
||||
distributing OpenPGP keys since 2019
|
26
src/mail.rs
26
src/mail.rs
|
@ -148,32 +148,6 @@ impl Service {
|
|||
)
|
||||
}
|
||||
|
||||
pub fn send_upload(
|
||||
&self,
|
||||
base_uri: &str,
|
||||
tpk_name: String,
|
||||
userid: &Email,
|
||||
token: &str
|
||||
) -> Result<()> {
|
||||
let ctx = context::Welcome {
|
||||
lang: "en".to_owned(),
|
||||
primary_fp: tpk_name,
|
||||
uri: format!("{}/upload/{}", base_uri, token),
|
||||
base_uri: base_uri.to_owned(),
|
||||
domain: self.domain.clone(),
|
||||
};
|
||||
|
||||
counters::inc_mail_sent("upload", userid);
|
||||
|
||||
self.send(
|
||||
&vec![userid],
|
||||
&format!("Your key upload on {domain}", domain = self.domain),
|
||||
"upload",
|
||||
"en",
|
||||
ctx,
|
||||
)
|
||||
}
|
||||
|
||||
pub fn send_welcome(
|
||||
&self,
|
||||
base_uri: &str,
|
||||
|
|
|
@ -183,26 +183,9 @@ fn pks_add_ok(
|
|||
return format!("Upload successful.");
|
||||
}
|
||||
|
||||
// We send this out on the *second* time the key is uploaded (within one ratelimit period).
|
||||
let uploaded_repeatedly = !rate_limiter.action_perform(format!("hkp-upload-{}", &key_fpr));
|
||||
if uploaded_repeatedly && rate_limiter.action_perform(format!("hkp-sent-{}", &primary_uid)) {
|
||||
if send_upload_mail(&request_origin, &mail_service, key_fpr, &primary_uid, token) {
|
||||
return format!("Upload successful. An upload information email has been sent.");
|
||||
}
|
||||
}
|
||||
return format!("Upload successful. Please note that identity information will only be published after verification. See {baseuri}/about/usage#gnupg-upload", baseuri = request_origin.get_base_uri())
|
||||
}
|
||||
|
||||
fn send_upload_mail(
|
||||
request_origin: &RequestOrigin,
|
||||
mail_service: &mail::Service,
|
||||
fpr: String,
|
||||
primary_uid: &Email,
|
||||
token: String,
|
||||
) -> bool {
|
||||
mail_service.send_upload(request_origin.get_base_uri(), fpr, primary_uid, &token).is_ok()
|
||||
}
|
||||
|
||||
fn send_welcome_mail(
|
||||
request_origin: &RequestOrigin,
|
||||
mail_service: &mail::Service,
|
||||
|
@ -460,16 +443,6 @@ mod tests {
|
|||
let upload_mail_1 = pop_mail(filemail_into.as_path()).unwrap();
|
||||
assert!(upload_mail_1.is_none());
|
||||
|
||||
// Add the first again a second time - we should get an upload mail
|
||||
let response = client.post("/pks/add")
|
||||
.body(post_data_first.as_bytes())
|
||||
.header(ContentType::Form)
|
||||
.dispatch();
|
||||
assert_eq!(response.status(), Status::Ok);
|
||||
|
||||
let upload_mail_2 = pop_mail(filemail_into.as_path()).unwrap();
|
||||
assert!(upload_mail_2.is_some());
|
||||
|
||||
check_mr_responses_by_fingerprint(&client, &tpk_0, 0);
|
||||
check_mr_responses_by_fingerprint(&client, &tpk_1, 0);
|
||||
check_hr_responses_by_fingerprint(&client, &tpk_0, 0);
|
||||
|
|
Loading…
Reference in a new issue