From d3adcfab01eb85fdb59ad84d7ad29f4376445da3 Mon Sep 17 00:00:00 2001
From: Guillaume Rousse <guillaume.rousse@renater.fr>
Date: Fri, 3 Nov 2017 16:52:07 +0100
Subject: [PATCH] simplification: redirection is never used

---
 lib/IdPAccountManager/WebRequest.pm | 68 +++++++++++++----------------
 1 file changed, 30 insertions(+), 38 deletions(-)

diff --git a/lib/IdPAccountManager/WebRequest.pm b/lib/IdPAccountManager/WebRequest.pm
index 470e6ce..59d5bf2 100755
--- a/lib/IdPAccountManager/WebRequest.pm
+++ b/lib/IdPAccountManager/WebRequest.pm
@@ -159,49 +159,41 @@ sub respond {
           unless ($key eq 'out');
     }
 
-    ## An action may redirect to an external URL
-    if ($self->{url_redirection}) {
+    ## Parse template
+    my $tt2 = Template->new(
+        {
+            ENCODING => 'iso-8859-1',    ## le défaut apparemment
+            FILTERS  => {
+                encode_utf8 =>
+                  [ \&IdPAccountManager::Tools::encode_utf8, 0 ],
+                escape_quotes =>
+                  [ \&IdPAccountManager::Tools::escape_quotes, 0 ]
+            },
+            INCLUDE_PATH => $self->{configuration}->{root_manager_dir} . ':'
+              . $self->{configuration}->{root_manager_dir}
+              . '/templates/accountProfiles',
+
+            #DEBUG => 'all',
+            #DEBUG => 'caller',
+            #DEBUG => 'parser'
+        }
+    );
 
-        printf "Location: %s\n\n", $self->{url_redirection};
+    my $template;
 
+    ## nobanner is used to do AJAX to get only pieces of HTML to load in the web client
+    if ($self->{in}->{style} eq 'nobanner') {
+        $template = 'templates/web/index-nobanner.tt2.html';
     } else {
+        $template = 'templates/web/index.tt2.html';
+    }
 
-        ## Parse template
-        my $tt2 = Template->new(
-            {
-                ENCODING => 'iso-8859-1',    ## le défaut apparemment
-                FILTERS  => {
-                    encode_utf8 =>
-                      [ \&IdPAccountManager::Tools::encode_utf8, 0 ],
-                    escape_quotes =>
-                      [ \&IdPAccountManager::Tools::escape_quotes, 0 ]
-                },
-                INCLUDE_PATH => $self->{configuration}->{root_manager_dir} . ':'
-                  . $self->{configuration}->{root_manager_dir}
-                  . '/templates/accountProfiles',
-
-                #DEBUG => 'all',
-                #DEBUG => 'caller',
-                #DEBUG => 'parser'
-            }
+    unless ($tt2->process($template, $self->{out}, \*STDOUT)) {
+        printf "Content-type: text/plain\n\n Error: %s", $tt2->error();
+        $self->{logger}->log(
+            level   => LOG_ERROR,
+            message => sprintf("Web parser error : %s", $tt2->error())
         );
-
-        my $template;
-
-        ## nobanner is used to do AJAX to get only pieces of HTML to load in the web client
-        if ($self->{in}->{style} eq 'nobanner') {
-            $template = 'templates/web/index-nobanner.tt2.html';
-        } else {
-            $template = 'templates/web/index.tt2.html';
-        }
-
-        unless ($tt2->process($template, $self->{out}, \*STDOUT)) {
-            printf "Content-type: text/plain\n\n Error: %s", $tt2->error();
-            $self->{logger}->log(
-                level   => LOG_ERROR,
-                message => sprintf("Web parser error : %s", $tt2->error())
-            );
-        }
     }
 
     ## Ignore some type of errors
-- 
GitLab