From 4355cc725d2c201ab34cbab64cefd0b0678f65c4 Mon Sep 17 00:00:00 2001
From: Guillaume Rousse <guillaume.rousse@renater.fr>
Date: Thu, 24 May 2018 13:53:13 +0200
Subject: [PATCH] use proper input variable in each template

---
 lib/AccountManager/App.pm                 | 3 ---
 templates/web/complete_challenge.tt2.html | 2 +-
 templates/web/select_email.tt2.html       | 2 +-
 templates/web/select_federation.tt2.html  | 2 +-
 templates/web/select_sp.tt2.html          | 2 +-
 5 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/lib/AccountManager/App.pm b/lib/AccountManager/App.pm
index fc4f019..182e110 100644
--- a/lib/AccountManager/App.pm
+++ b/lib/AccountManager/App.pm
@@ -266,9 +266,6 @@ sub req_select_sp {
     $self->respond(
         template => 'select_sp.tt2.html',
         data     => {
-            env => {
-                SCRIPT_NAME => $ENV{SCRIPT_NAME}
-            },
             metadata   => $metadata->parse(type => 'sp'),
             federation => $federation,
         }
diff --git a/templates/web/complete_challenge.tt2.html b/templates/web/complete_challenge.tt2.html
index 5ed0e32..a8a165d 100644
--- a/templates/web/complete_challenge.tt2.html
+++ b/templates/web/complete_challenge.tt2.html
@@ -15,7 +15,7 @@
             [% lh.maketext("An email challenge including a validation token has been emailed to you at [_1].", email) %]
             [% lh.maketext("Please copy and paste the validation token in the form below to proof that you are administrator of this service.") %]
         </p>
-        <form action="[% env.SCRIPT_NAME %]" method="get">
+        <form action="[% app.url %]" method="get">
             <label for="token">[% lh.maketext("Please provide the validation token here:") %]</label>
             <input name="token" value="" id="token" type="text" class="required error"/>
             <input type="hidden" name="entityid" value="[% entityid %]"/>
diff --git a/templates/web/select_email.tt2.html b/templates/web/select_email.tt2.html
index 9b14a95..d391ad1 100644
--- a/templates/web/select_email.tt2.html
+++ b/templates/web/select_email.tt2.html
@@ -14,7 +14,7 @@
         <p>[% lh.maketext("Before you can create test accounts at this Identity Provider, we need to ensure you are a legitimate administrator of '[_1]'.", sp.displayname) %]</p>
 
     [% IF sp.contacts.defined %]
-        <form action="[% env.SCRIPT_NAME %]" method="get">
+        <form action="[% app.url %]" method="get">
             <p>[% lh.maketext("Select the email address where an email challenge can be sent to validate your identity:") %]</p>
         [% FOREACH email IN sp.contacts.sort %]
             <input id="[% email %]" name="email" value="[% email %]" type="radio" class="required"/>
diff --git a/templates/web/select_federation.tt2.html b/templates/web/select_federation.tt2.html
index 1983f9e..acf9783 100644
--- a/templates/web/select_federation.tt2.html
+++ b/templates/web/select_federation.tt2.html
@@ -12,7 +12,7 @@
     <div class="content clearfix">
         <h2>[% lh.maketext("Select your federation") %]</h2>
 
-        <form action="[% env.SCRIPT_NAME %]" method="get">
+        <form action="[% app.url %]" method="get">
             <p>[% lh.maketext("Select the federation corresponding to the service you want to test::") %]</p>
         [% FOREACH federation IN federations.sort %]
             <input id="[% federation %]" name="federation" value="[% federation %]" type="radio" class="required"/>
diff --git a/templates/web/select_sp.tt2.html b/templates/web/select_sp.tt2.html
index e47b596..4962f79 100644
--- a/templates/web/select_sp.tt2.html
+++ b/templates/web/select_sp.tt2.html
@@ -16,7 +16,7 @@
             [% lh.maketext("You must be an administrator of that service to continue afterwards.") %]
         </p>
 
-        <form action="[% env.SCRIPT_NAME %]" method="get">
+        <form action="[% app.url %]" method="get">
             <label for="entityid">[% lh.maketext("Type the name or entityID of service to test:") %]</label>
             <br/>
             <select id="entityid" name="entityid" class="required">
-- 
GitLab