1
0
Fork 0

Move email templates to subfolder

Dieser Commit ist enthalten in:
Daniel García 2019-01-19 16:52:12 +01:00
Ursprung 86a254ad9e
Commit 97aa407fe4
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: FC8A7D14C3CD543A
7 geänderte Dateien mit 10 neuen und 10 gelöschten Zeilen

Datei anzeigen

@ -54,9 +54,9 @@ fn get_text(template_name: &'static str, data: serde_json::Value) -> Result<(Str
pub fn send_password_hint(address: &str, hint: Option<String>, config: &MailConfig) -> EmptyResult { pub fn send_password_hint(address: &str, hint: Option<String>, config: &MailConfig) -> EmptyResult {
let template_name = if hint.is_some() { let template_name = if hint.is_some() {
"email_pw_hint_some" "email/pw_hint_some"
} else { } else {
"email_pw_hint_none" "email/pw_hint_none"
}; };
let (subject, body) = get_text(template_name, json!({ "hint": hint }))?; let (subject, body) = get_text(template_name, json!({ "hint": hint }))?;
@ -83,7 +83,7 @@ pub fn send_invite(
let invite_token = encode_jwt(&claims); let invite_token = encode_jwt(&claims);
let (subject, body) = get_text( let (subject, body) = get_text(
"email_send_org_invite", "email/send_org_invite",
json!({ json!({
"url": CONFIG.domain, "url": CONFIG.domain,
"org_id": org_id.unwrap_or("_".to_string()), "org_id": org_id.unwrap_or("_".to_string()),
@ -99,7 +99,7 @@ pub fn send_invite(
pub fn send_invite_accepted(new_user_email: &str, address: &str, org_name: &str, config: &MailConfig) -> EmptyResult { pub fn send_invite_accepted(new_user_email: &str, address: &str, org_name: &str, config: &MailConfig) -> EmptyResult {
let (subject, body) = get_text( let (subject, body) = get_text(
"email_invite_accepted", "email/invite_accepted",
json!({ json!({
"url": CONFIG.domain, "url": CONFIG.domain,
"email": new_user_email, "email": new_user_email,
@ -112,7 +112,7 @@ pub fn send_invite_accepted(new_user_email: &str, address: &str, org_name: &str,
pub fn send_invite_confirmed(address: &str, org_name: &str, config: &MailConfig) -> EmptyResult { pub fn send_invite_confirmed(address: &str, org_name: &str, config: &MailConfig) -> EmptyResult {
let (subject, body) = get_text( let (subject, body) = get_text(
"email_invite_confirmed", "email/invite_confirmed",
json!({ json!({
"url": CONFIG.domain, "url": CONFIG.domain,
"org_name": org_name, "org_name": org_name,

Datei anzeigen

@ -345,11 +345,11 @@ fn load_templates(path: String) -> Handlebars {
} }
// First register default templates here (use include_str?) // First register default templates here (use include_str?)
reg!("email_invite_accepted"); reg!("email/invite_accepted");
reg!("email_invite_confirmed"); reg!("email/invite_confirmed");
reg!("email_pw_hint_none"); reg!("email/pw_hint_none");
reg!("email_pw_hint_some"); reg!("email/pw_hint_some");
reg!("email_send_org_invite"); reg!("email/send_org_invite");
// And then load user templates to overwrite the defaults // And then load user templates to overwrite the defaults
// Use .hbs extension for the files // Use .hbs extension for the files