Skip to content
Snippets Groups Projects
Commit 0d66ebf3 authored by Guillaume ROUSSE's avatar Guillaume ROUSSE
Browse files

wrap content, instead of including it

parent db22a2a8
Branches
Tags
No related merge requests found
...@@ -70,9 +70,8 @@ sub new { ...@@ -70,9 +70,8 @@ sub new {
"No mailer defined in configuration, aborting" "No mailer defined in configuration, aborting"
); );
$self->respond( $self->respond(
template => 'index.tt2.html', template => 'errors.tt2.html',
data => { data => {
content => 'errors.tt2.html',
errors => [ 'internal' ] errors => [ 'internal' ]
} }
); );
...@@ -83,9 +82,8 @@ sub new { ...@@ -83,9 +82,8 @@ sub new {
"No IDP defined in configuration, aborting" "No IDP defined in configuration, aborting"
); );
$self->respond( $self->respond(
template => 'index.tt2.html', template => 'errors.tt2.html',
data => { data => {
content => 'errors.tt2.html',
errors => [ 'internal' ] errors => [ 'internal' ]
} }
); );
...@@ -96,9 +94,8 @@ sub new { ...@@ -96,9 +94,8 @@ sub new {
"No database defined in configuration, aborting" "No database defined in configuration, aborting"
); );
$self->respond( $self->respond(
template => 'index.tt2.html', template => 'errors.tt2.html',
data => { data => {
content => 'errors.tt2.html',
errors => [ 'internal' ] errors => [ 'internal' ]
} }
); );
...@@ -156,9 +153,8 @@ sub run { ...@@ -156,9 +153,8 @@ sub run {
## unknown action ## unknown action
$self->{logger}->error( "Unknown action '$action'"); $self->{logger}->error( "Unknown action '$action'");
$self->respond( $self->respond(
template => 'index.tt2.html', template => 'errors.tt2.html',
data => { data => {
content => 'errors.tt2.html',
errors => [ "Unknown action '$action'" ] errors => [ "Unknown action '$action'" ]
} }
); );
...@@ -185,7 +181,7 @@ sub respond { ...@@ -185,7 +181,7 @@ sub respond {
INCLUDE_PATH => $self->{configuration}->{setup}->{templates_dir} . "/web" INCLUDE_PATH => $self->{configuration}->{setup}->{templates_dir} . "/web"
}); });
$self->{logger}->debug("Responding with outer template '$in{template}' and inner template '$in{data}->{content}'"); $self->{logger}->debug("Responding with outer template '$in{template}'");
binmode(STDOUT, ":utf8"); binmode(STDOUT, ":utf8");
...@@ -215,22 +211,20 @@ sub req_select_sp { ...@@ -215,22 +211,20 @@ sub req_select_sp {
if ($EVAL_ERROR) { if ($EVAL_ERROR) {
$self->{logger}->error("Failed to load federation metadata: $EVAL_ERROR"); $self->{logger}->error("Failed to load federation metadata: $EVAL_ERROR");
$self->respond( $self->respond(
template => 'index.tt2.html', template => 'errors.tt2.html',
data => { data => {
content => 'errors.tt2.html',
errors => [ "internal" ] errors => [ "internal" ]
} }
); );
} }
$self->respond( $self->respond(
template => 'index.tt2.html', template => 'select_sp.tt2.html',
data => { data => {
env => { env => {
SCRIPT_NAME => $ENV{SCRIPT_NAME} SCRIPT_NAME => $ENV{SCRIPT_NAME}
}, },
metadata => $metadata->parse(type => 'sp'), metadata => $metadata->parse(type => 'sp'),
content => 'select_sp.tt2.html'
} }
); );
} }
...@@ -241,9 +235,8 @@ sub req_select_email { ...@@ -241,9 +235,8 @@ sub req_select_email {
if (! $self->{in}->{entityid}) { if (! $self->{in}->{entityid}) {
$self->{logger}->error("Missing parameter: entityid"); $self->{logger}->error("Missing parameter: entityid");
$self->respond( $self->respond(
template => 'index.tt2.html', template => 'errors.tt2.html',
data => { data => {
content => 'errors.tt2.html',
errors => [ "missing_entityid" ] errors => [ "missing_entityid" ]
} }
); );
...@@ -252,9 +245,8 @@ sub req_select_email { ...@@ -252,9 +245,8 @@ sub req_select_email {
if ($self->{in}->{entityid} !~ $entity_id_pattern) { if ($self->{in}->{entityid} !~ $entity_id_pattern) {
$self->{logger}->error("Incorrect parameter format: entityid"); $self->{logger}->error("Incorrect parameter format: entityid");
$self->respond( $self->respond(
template => 'index.tt2.html', template => 'errors.tt2.html',
data => { data => {
content => 'errors.tt2.html',
errors => [ "format_entityid" ] errors => [ "format_entityid" ]
} }
); );
...@@ -280,9 +272,8 @@ sub req_select_email { ...@@ -280,9 +272,8 @@ sub req_select_email {
if ($EVAL_ERROR) { if ($EVAL_ERROR) {
$self->{logger}->error("Failed to load federation metadata: $EVAL_ERROR"); $self->{logger}->error("Failed to load federation metadata: $EVAL_ERROR");
$self->respond( $self->respond(
template => 'index.tt2.html', template => 'errors.tt2.html',
data => { data => {
content => 'errors.tt2.html',
errors => [ "internal" ] errors => [ "internal" ]
} }
); );
...@@ -294,9 +285,8 @@ sub req_select_email { ...@@ -294,9 +285,8 @@ sub req_select_email {
"No such SP '%s' in metadata", $self->{in}->{entityid} "No such SP '%s' in metadata", $self->{in}->{entityid}
); );
$self->respond( $self->respond(
template => 'index.tt2.html', template => 'errors.tt2.html',
data => { data => {
content => 'errors.tt2.html',
errors => [ "no_such_entity" ] errors => [ "no_such_entity" ]
} }
); );
...@@ -312,9 +302,8 @@ sub req_select_email { ...@@ -312,9 +302,8 @@ sub req_select_email {
unless ($sp->save()) { unless ($sp->save()) {
$self->{logger}->error("Failed to save service provider object"); $self->{logger}->error("Failed to save service provider object");
$self->respond( $self->respond(
template => 'index.tt2.html', template => 'errors.tt2.html',
data => { data => {
content => 'errors.tt2.html',
errors => [ "internal" ] errors => [ "internal" ]
} }
); );
...@@ -337,10 +326,9 @@ sub req_select_email { ...@@ -337,10 +326,9 @@ sub req_select_email {
} }
$self->respond( $self->respond(
template => 'index.tt2.html', template => 'select_email.tt2.html',
data => { data => {
sp => $sp, sp => $sp,
content => 'select_email.tt2.html'
} }
); );
} }
...@@ -351,7 +339,7 @@ sub req_complete_challenge { ...@@ -351,7 +339,7 @@ sub req_complete_challenge {
unless ($self->{in}->{entityid}) { unless ($self->{in}->{entityid}) {
$self->{logger}->error("Missing parameter entityid"); $self->{logger}->error("Missing parameter entityid");
$self->respond( $self->respond(
template => 'index.tt2.html', template => 'errors.tt2.html',
data => { data => {
errors => [ "missing_entityid" ] errors => [ "missing_entityid" ]
} }
...@@ -361,9 +349,8 @@ sub req_complete_challenge { ...@@ -361,9 +349,8 @@ sub req_complete_challenge {
unless ($self->{in}->{email}) { unless ($self->{in}->{email}) {
$self->{logger}->error("Missing parameter email"); $self->{logger}->error("Missing parameter email");
$self->respond( $self->respond(
template => 'index.tt2.html', template => 'errors.tt2.html',
data => { data => {
content => 'errors.tt2.html',
errors => [ "missing_email" ] errors => [ "missing_email" ]
} }
); );
...@@ -377,9 +364,8 @@ sub req_complete_challenge { ...@@ -377,9 +364,8 @@ sub req_complete_challenge {
unless ($provider->load(speculative => 1)) { unless ($provider->load(speculative => 1)) {
$self->{logger}->errorf("No such SP '%s' in database", $self->{in}->{entityid}); $self->{logger}->errorf("No such SP '%s' in database", $self->{in}->{entityid});
$self->respond( $self->respond(
template => 'index.tt2.html', template => 'errors.tt2.html',
data => { data => {
content => 'errors.tt2.html',
errors => [ "no_such_entity" ] errors => [ "no_such_entity" ]
} }
); );
...@@ -409,9 +395,8 @@ sub req_complete_challenge { ...@@ -409,9 +395,8 @@ sub req_complete_challenge {
$self->{in}->{email} $self->{in}->{email}
); );
$self->respond( $self->respond(
template => 'index.tt2.html', template => 'errors.tt2.html',
data => { data => {
content => 'errors.tt2.html',
errors => [ "internal" ] errors => [ "internal" ]
} }
); );
...@@ -431,9 +416,8 @@ sub req_complete_challenge { ...@@ -431,9 +416,8 @@ sub req_complete_challenge {
$old_token->id() $old_token->id()
); );
$self->respond( $self->respond(
template => 'index.tt2.html', template => 'errors.tt2.html',
data => { data => {
content => 'errors.tt2.html',
errors => [ "internal" ] errors => [ "internal" ]
} }
); );
...@@ -455,9 +439,8 @@ sub req_complete_challenge { ...@@ -455,9 +439,8 @@ sub req_complete_challenge {
unless ($token->save()) { unless ($token->save()) {
$self->{logger}->error("Failed to save authentication token"); $self->{logger}->error("Failed to save authentication token");
$self->respond( $self->respond(
template => 'index.tt2.html', template => 'errors.tt2.html',
data => { data => {
content => 'errors.tt2.html',
errors => [ "internal" ] errors => [ "internal" ]
} }
); );
...@@ -471,9 +454,8 @@ sub req_complete_challenge { ...@@ -471,9 +454,8 @@ sub req_complete_challenge {
open(my $handle, '|-', "$sendmail -f $sender $recipient") or do { open(my $handle, '|-', "$sendmail -f $sender $recipient") or do {
$self->{logger}->errorf("Unable to run sendmail executable: %s", $ERRNO); $self->{logger}->errorf("Unable to run sendmail executable: %s", $ERRNO);
$self->respond( $self->respond(
template => 'index.tt2.html', template => 'errors.tt2.html',
data => { data => {
content => 'errors.tt2.html',
errors => [ "mail_notification_error" ] errors => [ "mail_notification_error" ]
} }
); );
...@@ -504,9 +486,8 @@ sub req_complete_challenge { ...@@ -504,9 +486,8 @@ sub req_complete_challenge {
unless ($tt2->process($template, $data, $handle)) { unless ($tt2->process($template, $data, $handle)) {
$self->{logger}->errorf("Mail notification error: %s", $tt2->error()); $self->{logger}->errorf("Mail notification error: %s", $tt2->error());
$self->respond( $self->respond(
template => 'index.tt2.html', template => 'errors.tt2.html',
data => { data => {
content => 'errors.tt2.html',
errors => [ "mail_notification_failure" ] errors => [ "mail_notification_failure" ]
} }
); );
...@@ -522,11 +503,10 @@ sub req_complete_challenge { ...@@ -522,11 +503,10 @@ sub req_complete_challenge {
); );
$self->respond( $self->respond(
template => 'index.tt2.html', template => 'complete_challenge.tt2.html',
data => { data => {
email => $self->{in}->{email}, email => $self->{in}->{email},
entityid => $self->{in}->{entityid}, entityid => $self->{in}->{entityid},
content => 'complete_challenge.tt2.html'
} }
); );
} }
...@@ -537,9 +517,8 @@ sub req_create_accounts { ...@@ -537,9 +517,8 @@ sub req_create_accounts {
unless ($self->{in}->{entityid}) { unless ($self->{in}->{entityid}) {
$self->{logger}->error("Missing parameter entityid"); $self->{logger}->error("Missing parameter entityid");
$self->respond( $self->respond(
template => 'index.tt2.html', template => 'errors.tt2.html',
data => { data => {
content => 'errors.tt2.html',
errors => [ "missing_entityid" ] errors => [ "missing_entityid" ]
} }
); );
...@@ -548,9 +527,8 @@ sub req_create_accounts { ...@@ -548,9 +527,8 @@ sub req_create_accounts {
unless ($self->{in}->{token}) { unless ($self->{in}->{token}) {
$self->{logger}->error("Missing parameter token"); $self->{logger}->error("Missing parameter token");
$self->respond( $self->respond(
template => 'index.tt2.html', template => 'errors.tt2.html',
data => { data => {
content => 'errors.tt2.html',
errors => [ "missing_token" ] errors => [ "missing_token" ]
} }
); );
...@@ -559,9 +537,8 @@ sub req_create_accounts { ...@@ -559,9 +537,8 @@ sub req_create_accounts {
unless ($self->{in}->{email}) { unless ($self->{in}->{email}) {
$self->{logger}->error("Missing parameter email"); $self->{logger}->error("Missing parameter email");
$self->respond( $self->respond(
template => 'index.tt2.html', template => 'errors.tt2.html',
data => { data => {
content => 'errors.tt2.html',
errors => [ "missing_email" ] errors => [ "missing_email" ]
} }
); );
...@@ -579,9 +556,8 @@ sub req_create_accounts { ...@@ -579,9 +556,8 @@ sub req_create_accounts {
$self->{in}->{entityid} $self->{in}->{entityid}
); );
$self->respond( $self->respond(
template => 'index.tt2.html', template => 'errors.tt2.html',
data => { data => {
content => 'errors.tt2.html',
errors => [ "wrong_token" ] errors => [ "wrong_token" ]
} }
); );
...@@ -594,9 +570,8 @@ sub req_create_accounts { ...@@ -594,9 +570,8 @@ sub req_create_accounts {
$self->{in}->{entityid} $self->{in}->{entityid}
); );
$self->respond( $self->respond(
template => 'index.tt2.html', template => 'errors.tt2.html',
data => { data => {
content => 'errors.tt2.html',
errors => [ "wrong_token_for_sp" ] errors => [ "wrong_token_for_sp" ]
} }
); );
...@@ -634,9 +609,8 @@ sub req_create_accounts { ...@@ -634,9 +609,8 @@ sub req_create_accounts {
unless ($download_token->save()) { unless ($download_token->save()) {
$self->{logger}->error("Failed to save authentication token"); $self->{logger}->error("Failed to save authentication token");
$self->respond( $self->respond(
template => 'index.tt2.html', template => 'errors.tt2.html',
data => { data => {
content => 'errors.tt2.html',
errors => [ "internal" ] errors => [ "internal" ]
} }
); );
...@@ -668,9 +642,8 @@ sub req_create_accounts { ...@@ -668,9 +642,8 @@ sub req_create_accounts {
$self->{in}->{entityid} $self->{in}->{entityid}
); );
$self->respond( $self->respond(
template => 'index.tt2.html', template => 'errors.tt2.html',
data => { data => {
content => 'errors.tt2.html',
errors => [ "accounts_creation_failure" ] errors => [ "accounts_creation_failure" ]
} }
); );
...@@ -694,9 +667,8 @@ sub req_create_accounts { ...@@ -694,9 +667,8 @@ sub req_create_accounts {
$EVAL_ERROR $EVAL_ERROR
); );
$self->respond( $self->respond(
template => 'index.tt2.html', template => 'errors.tt2.html',
data => { data => {
content => 'errors.tt2.html',
errors => [ "accounts_creation_failed" ] errors => [ "accounts_creation_failed" ]
} }
); );
...@@ -709,13 +681,12 @@ sub req_create_accounts { ...@@ -709,13 +681,12 @@ sub req_create_accounts {
); );
$self->respond( $self->respond(
template => 'index.tt2.html', template => 'create_accounts.tt2.html',
data => { data => {
accounts => \@accounts, accounts => \@accounts,
entityid => $self->{in}->{entityid}, entityid => $self->{in}->{entityid},
key => $key, key => $key,
token => $download_token->token(), token => $download_token->token(),
content => 'create_accounts.tt2.html'
} }
); );
} }
...@@ -726,9 +697,8 @@ sub req_download_accounts { ...@@ -726,9 +697,8 @@ sub req_download_accounts {
unless ($self->{in}->{entityid}) { unless ($self->{in}->{entityid}) {
$self->{logger}->error("Missing parameter entityid"); $self->{logger}->error("Missing parameter entityid");
$self->respond( $self->respond(
template => 'index.tt2.html', template => 'errors.tt2.html',
data => { data => {
content => 'errors.tt2.html',
errors => [ "missing_entityid" ] errors => [ "missing_entityid" ]
} }
); );
...@@ -737,9 +707,8 @@ sub req_download_accounts { ...@@ -737,9 +707,8 @@ sub req_download_accounts {
unless ($self->{in}->{token}) { unless ($self->{in}->{token}) {
$self->{logger}->error("Missing parameter token"); $self->{logger}->error("Missing parameter token");
$self->respond( $self->respond(
template => 'index.tt2.html', template => 'errors.tt2.html',
data => { data => {
content => 'errors.tt2.html',
errors => [ "missing_token" ] errors => [ "missing_token" ]
} }
); );
...@@ -748,9 +717,8 @@ sub req_download_accounts { ...@@ -748,9 +717,8 @@ sub req_download_accounts {
unless ($self->{in}->{key}) { unless ($self->{in}->{key}) {
$self->{logger}->error("Missing parameter key"); $self->{logger}->error("Missing parameter key");
$self->respond( $self->respond(
template => 'index.tt2.html', template => 'errors.tt2.html',
data => { data => {
content => 'errors.tt2.html',
errors => [ "missing_key" ] errors => [ "missing_key" ]
} }
); );
...@@ -767,9 +735,8 @@ sub req_download_accounts { ...@@ -767,9 +735,8 @@ sub req_download_accounts {
$self->{in}->{token}, $self->{in}->{token},
); );
$self->respond( $self->respond(
template => 'index.tt2.html', template => 'errors.tt2.html',
data => { data => {
content => 'errors.tt2.html',
errors => [ "wrong_token" ] errors => [ "wrong_token" ]
} }
); );
...@@ -782,9 +749,8 @@ sub req_download_accounts { ...@@ -782,9 +749,8 @@ sub req_download_accounts {
$self->{in}->{entityid} $self->{in}->{entityid}
); );
$self->respond( $self->respond(
template => 'index.tt2.html', template => 'errors.tt2.html',
data => { data => {
content => 'errors.tt2.html',
errors => [ "wrong_token_for_sp" ] errors => [ "wrong_token_for_sp" ]
} }
); );
...@@ -857,10 +823,7 @@ sub req_home { ...@@ -857,10 +823,7 @@ sub req_home {
my ($self) = @_; my ($self) = @_;
$self->respond( $self->respond(
template => 'index.tt2.html', template => 'home.tt2.html',
data => {
content => 'home.tt2.html'
}
); );
} }
......
[% WRAPPER index.tt2.html %]
<div class="wizard clearfix vertical"> <div class="wizard clearfix vertical">
<div class="steps clearfix"> <div class="steps clearfix">
<ol> <ol>
...@@ -23,3 +24,4 @@ ...@@ -23,3 +24,4 @@
</form> </form>
</div> </div>
</div> </div>
[% END %]
[% WRAPPER index.tt2.html %]
<div class="grid-x align-center"> <div class="grid-x align-center">
<div class="cell shrink"> <div class="cell shrink">
<div class="callout success"> <div class="callout success">
...@@ -91,3 +92,4 @@ ...@@ -91,3 +92,4 @@
<strong>[% lh.maketext("Thank you for using the eduGAIN Access Check") %]</strong> <strong>[% lh.maketext("Thank you for using the eduGAIN Access Check") %]</strong>
</div> </div>
</div> </div>
[% END %]
[% WRAPPER index.tt2.html %]
<div class="ui-widget"> <div class="ui-widget">
[% FOREACH err IN errors %] [% FOREACH err IN errors %]
...@@ -36,3 +37,4 @@ ...@@ -36,3 +37,4 @@
[% lh.maketext("You can report the issue to the administrators") %] (<a href="mailto:[% app.support_email %]">[% app.support_email %]</a>). [% lh.maketext("You can report the issue to the administrators") %] (<a href="mailto:[% app.support_email %]">[% app.support_email %]</a>).
</div> </div>
[% END %]
[% WRAPPER index.tt2.html %]
<h2>[% lh.maketext("Objective") %]</h2> <h2>[% lh.maketext("Objective") %]</h2>
<p> <p>
[% [%
...@@ -17,3 +19,4 @@ ...@@ -17,3 +19,4 @@
<p>[% lh.maketext("To start testing your own services, start by selecting one your are administrator for.") %]</p> <p>[% lh.maketext("To start testing your own services, start by selecting one your are administrator for.") %]</p>
<p class="text-center"><a href="[% app.url %]?action=select_sp" class="button">[% lh.maketext("Get started") %]</a></p> <p class="text-center"><a href="[% app.url %]?action=select_sp" class="button">[% lh.maketext("Get started") %]</a></p>
[% END %]
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
</header> </header>
<main class="row"> <main class="row">
[% INCLUDE $content %] [% content %]
</main> </main>
<footer> <footer>
......
[% WRAPPER index.tt2.html %]
<div class="wizard clearfix"> <div class="wizard clearfix">
<div class="steps clearfix"> <div class="steps clearfix">
<ol> <ol>
...@@ -11,20 +12,20 @@ ...@@ -11,20 +12,20 @@
<h2>[% lh.maketext("Select your email address") %]</h2> <h2>[% lh.maketext("Select your email address") %]</h2>
<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> <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 %] [% IF sp.contacts.defined %]
<form action="[% env.SCRIPT_NAME %]" method="get"> <form action="[% env.SCRIPT_NAME %]" method="get">
<p>[% lh.maketext("Select the email address where an email challenge can be sent to validate your identity:") %]</p> <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 %] [% FOREACH email IN sp.contacts.sort %]
<input id="[% email %]" name="email" value="[% email %]" type="radio" class="required"/> <input id="[% email %]" name="email" value="[% email %]" type="radio" class="required"/>
<label for="[% email %]">[% email %]</label> <label for="[% email %]">[% email %]</label>
<br/> <br/>
[% END %] [% END %]
<p>[% lh.maketext("Those email addresses have been extracted from your service metadata.") %]</p> <p>[% lh.maketext("Those email addresses have been extracted from your service metadata.") %]</p>
<input type="hidden" name="entityid" value="[% sp.entityid %]"/> <input type="hidden" name="entityid" value="[% sp.entityid %]"/>
<button class="button" type="submit" name="action" value="select_sp">[% lh.maketext("Previous") %]</button> <button class="button" type="submit" name="action" value="select_sp">[% lh.maketext("Previous") %]</button>
<button class="button" type="submit" name="action" value="complete_challenge">[% lh.maketext("Next") %]</button> <button class="button" type="submit" name="action" value="complete_challenge">[% lh.maketext("Next") %]</button>
</form> </form>
[% ELSE %] [% ELSE %]
<p> <p>
[% lh.maketext("No ContactPerson element could be found in your service metadata, therefore we are unable to provide test accounts for this service.") %] [% lh.maketext("No ContactPerson element could be found in your service metadata, therefore we are unable to provide test accounts for this service.") %]
[% lh.maketext("Please contact your federation administrators to add needed information to the metadata.") %] [% lh.maketext("Please contact your federation administrators to add needed information to the metadata.") %]
...@@ -32,3 +33,4 @@ ...@@ -32,3 +33,4 @@
[% END %] [% END %]
</div> </div>
</div> </div>
[% END %]
[% WRAPPER index.tt2.html %]
<div class="wizard clearfix"> <div class="wizard clearfix">
<div class="steps clearfix"> <div class="steps clearfix">
<ol> <ol>
...@@ -163,3 +164,4 @@ $( document ).ready(function() { ...@@ -163,3 +164,4 @@ $( document ).ready(function() {
$( "#entityid" ).combobox(); $( "#entityid" ).combobox();
}); });
</script> </script>
[% END %]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment