From f36dc7f001429689bb467f5f9375594ce0ad5d73 Mon Sep 17 00:00:00 2001
From: Guillaume Rousse <guillaume.rousse@renater.fr>
Date: Fri, 23 Feb 2018 15:29:59 +0100
Subject: [PATCH] fix template variable names

---
 lib/AccountManager/WebRequest.pm              | 19 +++++++++----------
 .../mail/en/send_authentication_token.tt2.eml |  2 +-
 .../mail/fr/send_authentication_token.tt2.eml |  8 +++++---
 3 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/lib/AccountManager/WebRequest.pm b/lib/AccountManager/WebRequest.pm
index dfabd14..be22aab 100644
--- a/lib/AccountManager/WebRequest.pm
+++ b/lib/AccountManager/WebRequest.pm
@@ -446,18 +446,17 @@ sub req_complete_challenge {
     });
     my $template = 'send_authentication_token.tt2.eml';
     my $data = {
-        env => {
-            REMOTE_ADDR => $ENV{REMOTE_ADDR},
-        },
-        conf => {
-            app_name      => $self->{configuration}->{app}->{name},
-            app_url       => $self->{configuration}->{app}->{url},
+        app => {
+            name          => $self->{configuration}->{app}->{name},
+            url           => $self->{configuration}->{app}->{url},
             support_email => $self->{configuration}->{app}->{support_email},
+            version       => $self->{configuration}->{app}->{version},
         },
-        from     => $sender,
-        to       => $recipient,
-        entityid => $self->{in}->{entityid},
-        token    => $token->token(),
+        sourceip  => $ENV{REMOTE_ADDR},
+        from      => $sender,
+        to        => $recipient,
+        entityid  => $self->{in}->{entityid},
+        token     => $token->token(),
     };
 
     unless ($tt2->process($template, $data, $handle)) {
diff --git a/templates/mail/en/send_authentication_token.tt2.eml b/templates/mail/en/send_authentication_token.tt2.eml
index d892c14..a8f9f4d 100644
--- a/templates/mail/en/send_authentication_token.tt2.eml
+++ b/templates/mail/en/send_authentication_token.tt2.eml
@@ -3,7 +3,7 @@ To: [% to %]
 Subject: [% app.name %] - Test accounts request
 Content-type: text/plain; charset=UTF-8; format=flowed
 
-This is an email challenge automatically sent to you by [% app.name %]. Somebody with IP address [% env.REMOTE_ADDR %] has requested to create test accounts for eduGAIN Service Provider with entityID [% entityid %].
+This is an email challenge automatically sent to you by [% app.name %]. Somebody with IP address [% sourceip %] has requested to create test accounts for eduGAIN Service Provider with entityID [% entityid %].
 The address [% to %] is mentioned in the eduGAIN metadata as a contact for this Service Provider.
 
 To complete the creation of test accounts, paste the following validation token in the [% app.name %] web form.
diff --git a/templates/mail/fr/send_authentication_token.tt2.eml b/templates/mail/fr/send_authentication_token.tt2.eml
index 0e38677..4fc03ea 100644
--- a/templates/mail/fr/send_authentication_token.tt2.eml
+++ b/templates/mail/fr/send_authentication_token.tt2.eml
@@ -3,9 +3,11 @@ To: [% to %]
 Subject: [% app.name %] - Demande de comptes de test
 Content-type: text/plain; charset=UTF-8; format=flowed
 
-Ceci est un message envoyé automatiquement par l'application eduGAIN Access Check.
-Quelqu'un avec l'adresse IP [% env.REMOTE_ADDR %] a demandé la création de comptes de test pour le service [% entityid %].
-L'addresse [% to %] est mentionnée dans les métadonnées de la fédération eduGAIN comme contact pour ce service.
+Ceci est un message envoyé automatiquement par l'application eduGAIN
+Access Check.  Quelqu'un avec l'adresse IP [% sourceip %] a demandé la
+création de comptes de test pour le service [% entityid %].  L'addresse
+[% to %] est mentionnée dans les métadonnées de la fédération eduGAIN
+comme contact pour ce service.
 
 Pour terminer la création de ces comptes de test, recopiez le code de
 validation suivant dans l'application eduGAIN Access Check.
-- 
GitLab