diff --git a/lib/AccountManager/WebRequest.pm b/lib/AccountManager/WebRequest.pm index 3215458e6895df985f91a383f5194fcb61eaaa06..ee8cbae05b349c5b82f7e419617de72ea4244010 100644 --- a/lib/AccountManager/WebRequest.pm +++ b/lib/AccountManager/WebRequest.pm @@ -126,22 +126,13 @@ sub run { sub respond { my ($self, $data) = @_; - $data->{env} = { - REMOTE_HOST => $ENV{REMOTE_HOST}, - REMOTE_ADDR => $ENV{REMOTE_ADDR}, - SCRIPT_NAME => $ENV{SCRIPT_NAME} - }; - $data->{conf} = { - accounts_validity_period => $self->{configuration}->{service}->{account_validity_period}, - app_name => $self->{configuration}->{app}->{name}, - app_url => $self->{configuration}->{app}->{url}, - idp_scope => $self->{configuration}->{idp}->{scope}, - idp_displayname => $self->{configuration}->{idp}->{displayname}, - support_email => $self->{configuration}->{app}->{support_email}, - version => $self->{configuration}->{app}->{version}, + $data->{app} = { + name => $self->{configuration}->{app}->{name}, + url => $self->{configuration}->{app}->{url}, + support_email => $self->{configuration}->{app}->{support_email}, + version => $self->{configuration}->{app}->{version}, }; - $data->{title} = $self->{configuration}->{app}->{name}; ## Parse template my $tt2 = Template->new({ @@ -187,6 +178,9 @@ sub req_select_sp { } $self->respond({ + env => { + SCRIPT_NAME => $ENV{SCRIPT_NAME} + }, metadata => $metadata->parse(type => 'sp'), action => 'select_sp' }); @@ -363,7 +357,6 @@ sub req_complete_challenge { my $template = 'mail/send_authentication_token.tt2.eml'; my $data = { env => { - REMOTE_HOST => $ENV{REMOTE_HOST}, REMOTE_ADDR => $ENV{REMOTE_ADDR}, }, conf => { @@ -504,9 +497,11 @@ sub req_create_accounts { ); $self->respond({ - accounts => \@accounts, - entityid => $self->{in}->{entityid}, - action => 'create_accounts' + accounts => \@accounts, + accounts_validity_period => $self->{configuration}->{service}->{account_validity_period}, + idp_displayname => $self->{configuration}->{idp}->{displayname}, + entityid => $self->{in}->{entityid}, + action => 'create_accounts' }); } diff --git a/templates/mail/send_authentication_token.tt2.eml b/templates/mail/send_authentication_token.tt2.eml index 644131e9a3198b4dd2eefbbdf7b1befcaae74aae..d892c14c9a3fcba1ed6cb1e715d5df144a977eb6 100644 --- a/templates/mail/send_authentication_token.tt2.eml +++ b/templates/mail/send_authentication_token.tt2.eml @@ -1,18 +1,18 @@ -From: [% conf.app_name %] <[% from %]> +From: [% app.name %] <[% from %]> To: [% to %] -Subject: [% conf.app_name %] - Test accounts request +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 [% conf.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 [% env.REMOTE_ADDR %] 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 [% conf.app_name %] web form. +To complete the creation of test accounts, paste the following validation token in the [% app.name %] web form. Validation token: [% token %] -[% conf.app_name %]: [% conf.app_url %] +[% app.name %]: [% app.url %] -If the creation of test accounts was not initiated by you or a fellow administrator for the above Service Provider, please forward this email and contact [% conf.support_email %] to inform them about a potential abuse of the [% conf.app_name %] service. +If the creation of test accounts was not initiated by you or a fellow administrator for the above Service Provider, please forward this email and contact [% app.support_email %] to inform them about a potential abuse of the [% app.name %] service. Best Regards -[% conf.app_name %] Bot +[% app.name %] Bot diff --git a/templates/web/create_accounts.tt2.html b/templates/web/create_accounts.tt2.html index 9cd744c0952a449bc4461c1a620f113b03dc8278..27602a36e6ac19627eaab0130fad5068fe9555ee 100644 --- a/templates/web/create_accounts.tt2.html +++ b/templates/web/create_accounts.tt2.html @@ -8,7 +8,7 @@ <h3>The following test accounts with different profiles were created for you:</h3> <p>You can now use these test accounts to login at your federated service.<br/> - <strong>To do so, select the "[% conf.idp_displayname %]" when choosing an organisation to login at.</strong></p> + <strong>To do so, select the "[% idp_displayname %]" when choosing an organisation to login at.</strong></p> </div> <div class="accounts_profile"> @@ -33,7 +33,7 @@ <div class="accounts_profile reveal-modal" data-reveal id="account_details_[% account.id() %]"> <!-- old version : class="account_details"--> <h3>List of user attributes associated</h3> <p>Below is the list of user attributes associated to this test account. After a successfull authentication process these attributes are transmited - via the SAML protocol from [% conf.app_name %] Identity Provider to your Service Provider.</p> + via the SAML protocol from [% app.name %] Identity Provider to your Service Provider.</p> <div> <table> <caption>List of user attributes</caption> @@ -48,7 +48,7 @@ </table> </div> - <div class="alert-box info radius">If you need a customized test account with additional user attributes, you should contact <a href="mailto:[% conf.support_email %]">[% conf.support_email %]</a>.</div> + <div class="alert-box info radius">If you need a customized test account with additional user attributes, you should contact <a href="mailto:[% app.support_email %]">[% app.support_email %]</a>.</div> <div>(1) eduPersonAffiliation and eduPersonScoppedAffilisation attributes are assigned quite differently from federation to federation. <a href="http://tnc2010.terena.org/files/ePSA%20comparison%20v0%2006.ppt">This usage comparison of eduPersonAffiliation accross different countries</a> discusses these differences. Therefore its values should be handled with great care.</div> <a class="close-reveal-modal">×</a> </div> @@ -58,7 +58,7 @@ <p><strong>Please keep a record of the above user names and passwords</strong> because currently there is no mecanism to retrieve the above credentials once you close this page. If you forget the username and passwords, you can however request new test accounts.</p> <div class="alert-box warning radius"> - <p>Note that these test accounts will automatically expire in [% conf.accounts_validity_period %] days and that they can only be used to test federated login to your eduGAIN-enabled Service Provider with entityID <strong>[% entityid %]</strong>.</p> + <p>Note that these test accounts will automatically expire in [% accounts_validity_period %] days and that they can only be used to test federated login to your eduGAIN-enabled Service Provider with entityID <strong>[% entityid %]</strong>.</p> </div> -<p class="align-center"><Strong>Thank you for using the [% conf.app_name %]</strong></p> +<p class="align-center"><Strong>Thank you for using the [% app.name %]</strong></p> diff --git a/templates/web/errors.tt2.html b/templates/web/errors.tt2.html index 41384461db0a28730950fdcc24556855cdd16804..e138aebb75f4197e1ab7296d61c9547ada5223e8 100644 --- a/templates/web/errors.tt2.html +++ b/templates/web/errors.tt2.html @@ -30,5 +30,5 @@ <br/> [% END %] <!-- FOREACH --> - You can report the issue to the administrators (<a href="mailto:[% conf.support_email %]>">[% conf.support_email %]</a>). + You can report the issue to the administrators (<a href="mailto:[% app.support_email %]>">[% app.support_email %]</a>). [% END %] diff --git a/templates/web/home.tt2.html b/templates/web/home.tt2.html index e3ada94ae27dcc860cbade116abad8ed1c7f7949..d3daccce5c140b625cc17a1d33acb19005ebe3c3 100644 --- a/templates/web/home.tt2.html +++ b/templates/web/home.tt2.html @@ -3,7 +3,7 @@ $(function() { $('#start_testing').on('click',function() { - window.location.href='[% conf.app_url %]?action=select_sp'; + window.location.href='[% app.url %]?action=select_sp'; }); }); @@ -11,8 +11,8 @@ $(function() { <div class="row"> -<h2>[% conf.app_name %]?</h2> -<p>[% conf.app_name %] allows administrators of a Service +<h2>[% app.name %]?</h2> +<p>[% app.name %] 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. <a href="presentation.html">Learn more about this service...</a> @@ -24,9 +24,9 @@ Service Provider you are administrator for. </p> <p class="align-center"><button id="start_testing">Go on testing the service</button></p> -<h3>[% conf.app_name %] basics</h3> +<h3>[% app.name %] basics</h3> <p> -<br/><img alt="[% conf.app_name %] Basics" src="images/edugain_test_idp_basics.png"/> +<br/><img alt="[% app.name %] Basics" src="images/edugain_test_idp_basics.png"/> </p> </div> diff --git a/templates/web/index.tt2.html b/templates/web/index.tt2.html index 0368292116f9e628e3c88d4a61cc43e4b1ea6d20..b4e801cf6d201be654fbf337d0bb0432bfb5b631 100644 --- a/templates/web/index.tt2.html +++ b/templates/web/index.tt2.html @@ -20,7 +20,7 @@ <script type="text/javascript" src="jquery.steps.1.1.0.min.js"></script> <script type="text/javascript" src="account-manager.js"></script> - <title>[% title %]</title> + <title>[% app.name %]</title> </head> @@ -31,7 +31,7 @@ <a href="http://www.geant.net" title="Geant home page" target="_blank" class="right"><img alt="GEANT logo" width="100" src="images/geant_logo_rgb_300dpi.jpg"/></a> </div> <div class="title"> - <h1>[% title %]</h1> + <h1>[% app.name %]</h1> </div> </header> @@ -55,7 +55,7 @@ </div> <footer> - <span class="align-center">[% conf.app_name %] [% conf.version %] - <a href="mailto:[% conf.support_email %]">contact us</a></span> + <span class="align-center">[% app.name %] [% app.version %] - <a href="mailto:[% app.support_email %]">contact us</a></span> </footer> <script src="foundation/js/foundation.min.js"></script> diff --git a/templates/web/select_sp.tt2.html b/templates/web/select_sp.tt2.html index fc5e2fcec185a8ee4efe5c454c7ef082fd600a3d..feba550fd7562666896eb3b55c0944718d0ea288 100644 --- a/templates/web/select_sp.tt2.html +++ b/templates/web/select_sp.tt2.html @@ -21,7 +21,7 @@ jQuery(document).ready(function($){ form.steps("insert", 1, { title: "Select your email address", contentMode: "async", - contentUrl: "[% conf.app_url %]?action=select_email&style=nobanner&entityid="+ + contentUrl: "[% app.url %]?action=select_email&style=nobanner&entityid="+ encodeURIComponent($('#entityid').val()) }); } @@ -34,7 +34,7 @@ jQuery(document).ready(function($){ form.steps("insert", 2, { title: "Complete email challenge", contentMode: "async", - contentUrl: "[% conf.app_url %]?action=complete_challenge&style=nobanner&entityid="+ + contentUrl: "[% app.url %]?action=complete_challenge&style=nobanner&entityid="+ encodeURIComponent($('#entityid').val())+"&email="+encodeURIComponent($("input:checked[name='email']").val()) }); } @@ -43,7 +43,7 @@ jQuery(document).ready(function($){ // Result gets included in the next tab if (currentIndex === 2 && newIndex === 3) { - window.location="[% conf.app_url %]?action=create_accounts&entityid="+ + window.location="[% app.url %]?action=create_accounts&entityid="+ encodeURIComponent($('#entityid').val())+"&token="+encodeURIComponent($('#token').val()); }