chiark / gitweb /
email tokens, fixes
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 5 Dec 2020 16:42:02 +0000 (16:42 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 5 Dec 2020 16:42:02 +0000 (16:42 +0000)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
nwtemplates/token-other.tera
nwtemplates/token-unix.tera
src/spec.rs

index 5c3441e745617f8e9b37e454cb2a215eea85d34e..0cba1b0899d0d52f1070323ee8b32d8f10b1d0d1 100644 (file)
@@ -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.
index f764d2dc11039b3d80512100e21b3688adbe6460..c365bcad533e8b760ba44056e9819b82d28f0e8f 100644 (file)
@@ -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
index 35ed10681bcffeb7f7663e1657e45929f3573ac6..9c9f09e6bf3c16c1f5ff1dbebd050c7844058f2c 100644 (file)
@@ -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