From 323ddb92beacf88650612c940693c969ce79e2ef Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 5 Dec 2020 16:42:02 +0000 Subject: [PATCH] email tokens, fixes Signed-off-by: Ian Jackson --- nwtemplates/token-other.tera | 5 +++-- nwtemplates/token-unix.tera | 5 +++-- src/spec.rs | 16 +++++++++------- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/nwtemplates/token-other.tera b/nwtemplates/token-other.tera index 5c3441e7..0cba1b08 100644 --- a/nwtemplates/token-other.tera +++ b/nwtemplates/token-other.tera @@ -1,5 +1,5 @@ To: {{ player_email }} -Subject: Game access link {} +Subject: Game access link {{ game_name }} Hi. A user on this Otter game server, with account {{ account }} @@ -13,4 +13,5 @@ They have set for you the nickname, within the game, of {{ nick }} If you want that changing, please contact them. -Regards. +Regards, +Otter game server. diff --git a/nwtemplates/token-unix.tera b/nwtemplates/token-unix.tera index f764d2dc..c365bcad 100644 --- a/nwtemplates/token-unix.tera +++ b/nwtemplates/token-unix.tera @@ -1,6 +1,6 @@ From: Otter game server on behalf of <{{ unix_user }}}> To: {{ player_email }} -Subject: Game access link {{ name }} +Subject: Game access link {{ game_name }} Hi. I'm inviting you to join the game {{ game_name }} @@ -13,4 +13,5 @@ I have set for you the nickname, within the game, of {{ nick }} If you want that changing, please contact me. -Regards. +Regards, +{{ unix_user }}, via the Otter game server diff --git a/src/spec.rs b/src/spec.rs index 35ed1068..9c9f09e6 100644 --- a/src/spec.rs +++ b/src/spec.rs @@ -435,8 +435,8 @@ pub mod implementation { unix_user: user, common, }; - nwtemplates::render("token-unix", &data) - } + nwtemplates::render("token-unix.tera", &data) + }, _ => { #[derive(Debug,Serialize)] struct Data<'r> { @@ -448,8 +448,8 @@ pub mod implementation { account: account.to_string(), common, }; - nwtemplates::render("token-other", &data) - } + nwtemplates::render("token-other.tera", &data) + }, }.map_err(|e| anyhow!(e.to_string())) .context("render email template")?; @@ -469,9 +469,11 @@ pub mod implementation { unsafe { command.pre_exec(|| { // https://github.com/rust-lang/rust/issues/79731 - let r = libc::dup2(2,1); - if r == 0 { Ok(()) } - else { Err(io::Error::last_os_error()) } + match libc::dup2(2,1) { + 1 => Ok(()), + -1 => Err(io::Error::last_os_error()), + x => panic!("dup2(2,1) gave {}", x), + } }); } let st = command -- 2.30.2