From 08465c5f7f4181f82a4bc6ec192cde10681f2ecc Mon Sep 17 00:00:00 2001
From: "renater.salaun" <renater.salaun@047e039d-479c-447e-8a29-aa6bf4a09bab>
Date: Thu, 30 Oct 2014 11:14:01 +0000
Subject: [PATCH] Added homepage

git-svn-id: https://svn.geant.net/GEANT/edugain_testidp_account_manager/trunk@55 047e039d-479c-447e-8a29-aa6bf4a09bab
---
 bin/account-manager-web.pl     |  9 ++++++++-
 templates/web/content.tt2.html |  7 +++++++
 templates/web/home.tt2.html    | 31 +++++++++++++++++++++++++++++++
 templates/web/index.tt2.html   |  4 ++--
 4 files changed, 48 insertions(+), 3 deletions(-)
 create mode 100644 templates/web/home.tt2.html

diff --git a/bin/account-manager-web.pl b/bin/account-manager-web.pl
index 753ec43..e9aca92 100755
--- a/bin/account-manager-web.pl
+++ b/bin/account-manager-web.pl
@@ -37,6 +37,7 @@ my %actions = ('select_sp' => {'title_en' => 'Select your Service Provider'    }
                'account_wizard' => {'title_en' => 'Select your Service Provider'    },
                'generate_token' => {'title_en' => 'Generate an authentication token'},
                'validate_token' => {'title_en' => 'Validate an authentication token'},
+               'home' => {'title_en' => 'eduGAIN Test Identity Provider'},
     );
 
 ## Gives writes for the group
@@ -111,7 +112,7 @@ sub new {
   }else {
     ## Default action
     &IdPAccountManager::Tools::do_log('info', "Default action");
-    $request->{'action'} = 'account_wizard';
+    $request->{'action'} = 'home';
   }
         
   bless $request, $pkg;
@@ -401,4 +402,10 @@ sub req_validate_token {
     return 1;
 }
 
+## Return the homepage of the service
+sub req_home {
+    my $self = shift;
+    &IdPAccountManager::Tools::do_log('info', "");
 
+    return 1;
+}
diff --git a/templates/web/content.tt2.html b/templates/web/content.tt2.html
index 9432566..1ba1331 100644
--- a/templates/web/content.tt2.html
+++ b/templates/web/content.tt2.html
@@ -34,6 +34,13 @@
  [% CATCH %]
   An error occured
  [% END %]
+ 
+ [% ELSIF action == 'home' %]
+ [% TRY %]
+  [% PROCESS 'templates/web/home.tt2.html' %]
+ [% CATCH %]
+  An error occured
+ [% END %]
 
 [% ELSE %]
 Error: unknown action
diff --git a/templates/web/home.tt2.html b/templates/web/home.tt2.html
new file mode 100644
index 0000000..9ac361f
--- /dev/null
+++ b/templates/web/home.tt2.html
@@ -0,0 +1,31 @@
+<script type="text/javascript">
+
+$(function() {
+    
+    $('#start_testing').on('click',function() {
+        window.location.href='[% conf.app_url %]?action=account_wizard';
+    });
+});
+
+</script>
+
+
+<div>
+<h3>eduGAIN Test Identity Provider?</h3>
+The eduGAIN Test Identity Provider allows administrators of a Service
+Provider (SP) registered in <a href="http://www.geant.net/service/eduGAIN/Pages/home.aspx">eduGAIN</a> to create test
+accounts with different profiles to validate the behaviour and test
+federated login. The test accounts can only be used to access own services.
+<br/><br/>
+To start testing your own eduGAIN service, start by selecting the
+Service Provider you are administrator for.<br/>
+<button id="start_testing">Start testing your eduGAIN service</button>
+<br/><br/>
+
+<h3>How is it ensured that users can only test their own service?</h3>
+The eduGAIN Test Identity Provider exclusively allows creating test
+accounts only to users who can receive challenge emails for email
+addresses listed in the eduGAIN metadata for a particualar Service Provider.
+The test accounts can only be used to access one single service for
+which a user proofed that he is administrator.
+</div>
\ No newline at end of file
diff --git a/templates/web/index.tt2.html b/templates/web/index.tt2.html
index e722136..ab3248e 100644
--- a/templates/web/index.tt2.html
+++ b/templates/web/index.tt2.html
@@ -45,7 +45,7 @@ function hide(div) {
     oDiv.style.display = "none";
 }
 
-jQuery(document).ready(function($){
+jQuery(function($){
 
     $.widget( "custom.combobox", {
         _create: function() {
@@ -174,7 +174,7 @@ jQuery(document).ready(function($){
             this.element.show();
         }
     });
-})( jQuery );
+});
 
 //-->      
 </SCRIPT>
-- 
GitLab