diff --git a/lib/AccountManager/WebRequest.pm b/lib/AccountManager/WebRequest.pm index a1ba26a144150942570599748a3fee1a28a87b4c..54a0bd5181b486b477b63cd798dd14c8720c392c 100644 --- a/lib/AccountManager/WebRequest.pm +++ b/lib/AccountManager/WebRequest.pm @@ -96,7 +96,8 @@ sub run { $self->respond( template => 'index.tt2.html', data => { - errors => [ "format_$parameter" ] + content => 'errors.tt2.html', + errors => [ "format_$parameter" ] } ); } @@ -127,7 +128,8 @@ sub run { $self->respond( template => 'index.tt2.html', data => { - errors => [ "Unknown action '$action'" ] + content => 'errors.tt2.html', + errors => [ "Unknown action '$action'" ] } ); } @@ -185,6 +187,7 @@ sub req_select_sp { $self->respond( template => 'index.tt2.html', data => { + content => 'errors.tt2.html', errors => [ "internal" ] } ); @@ -197,7 +200,7 @@ sub req_select_sp { SCRIPT_NAME => $ENV{SCRIPT_NAME} }, metadata => $metadata->parse(type => 'sp'), - action => 'select_sp' + content => 'select_sp.tt2.html' } ); } @@ -210,7 +213,8 @@ sub req_select_email { $self->respond( template => 'index.tt2.html', data => { - errors => [ "missing_entityid" ] + content => 'errors.tt2.html', + errors => [ "missing_entityid" ] } ); } @@ -237,7 +241,8 @@ sub req_select_email { $self->respond( template => 'index.tt2.html', data => { - errors => [ "internal" ] + content => 'errors.tt2.html', + errors => [ "internal" ] } ); } @@ -250,7 +255,8 @@ sub req_select_email { $self->respond( template => 'index.tt2.html', data => { - errors => [ "no_such_entity" ] + content => 'errors.tt2.html', + errors => [ "no_such_entity" ] } ); } @@ -267,7 +273,8 @@ sub req_select_email { $self->respond( template => 'index.tt2.html', data => { - errors => [ "internal" ] + content => 'errors.tt2.html', + errors => [ "internal" ] } ); } @@ -292,7 +299,7 @@ sub req_select_email { template => 'index-nobanner.tt2.html', data => { provider => $provider, - action => 'select_email' + content => 'select_email.tt2.html' } ); } @@ -315,7 +322,8 @@ sub req_complete_challenge { $self->respond( template => 'index.tt2.html', data => { - errors => [ "missing_email" ] + content => 'errors.tt2.html', + errors => [ "missing_email" ] } ); } @@ -330,7 +338,8 @@ sub req_complete_challenge { $self->respond( template => 'index.tt2.html', data => { - errors => [ "no_such_entity" ] + content => 'errors.tt2.html', + errors => [ "no_such_entity" ] } ); } @@ -361,7 +370,8 @@ sub req_complete_challenge { $self->respond( template => 'index.tt2.html', data => { - errors => [ "internal" ] + content => 'errors.tt2.html', + errors => [ "internal" ] } ); } @@ -382,7 +392,8 @@ sub req_complete_challenge { $self->respond( template => 'index.tt2.html', data => { - errors => [ "internal" ] + content => 'errors.tt2.html', + errors => [ "internal" ] } ); } @@ -405,7 +416,8 @@ sub req_complete_challenge { $self->respond( template => 'index.tt2.html', data => { - errors => [ "internal" ] + content => 'errors.tt2.html', + errors => [ "internal" ] } ); } @@ -420,7 +432,8 @@ sub req_complete_challenge { $self->respond( template => 'index.tt2.html', data => { - errors => [ "mail_notification_error" ] + content => 'errors.tt2.html', + errors => [ "mail_notification_error" ] } ); }; @@ -450,7 +463,8 @@ sub req_complete_challenge { $self->respond( template => 'index.tt2.html', data => { - errors => [ "mail_notification_error" ] + content => 'errors.tt2.html', + errors => [ "mail_notification_error" ] } ); } @@ -469,7 +483,7 @@ sub req_complete_challenge { data => { email => $self->{in}->{email}, entityid => $self->{in}->{entityid}, - action => 'complete_challenge' + content => 'complete_challenge.tt2.html' } ); } @@ -482,14 +496,21 @@ sub req_create_accounts { $self->respond( template => 'index.tt2.html', data => { - errors => [ "missing_entityid" ] + content => 'errors.tt2.html', + errors => [ "missing_entityid" ] } ); } unless ($self->{in}->{token}) { $self->{logger}->error("Missing parameter token"); - $self->respond({ errors => [ "missing_token" ] }); + $self->respond( + template => 'index.tt2.html', + data => { + content => 'errors.tt2.html', + errors => [ "missing_token" ] + } + ); } unless ($self->{in}->{email}) { @@ -497,7 +518,8 @@ sub req_create_accounts { $self->respond( template => 'index.tt2.html', data => { - errors => [ "missing_email" ] + content => 'errors.tt2.html', + errors => [ "missing_email" ] } ); } @@ -516,7 +538,8 @@ sub req_create_accounts { $self->respond( template => 'index.tt2.html', data => { - errors => [ "wrong_token" ] + content => 'errors.tt2.html', + errors => [ "wrong_token" ] } ); } @@ -530,7 +553,8 @@ sub req_create_accounts { $self->respond( template => 'index.tt2.html', data => { - errors => [ "wrong_token_for_sp" ] + content => 'errors.tt2.html', + errors => [ "wrong_token_for_sp" ] } ); } @@ -569,7 +593,8 @@ sub req_create_accounts { $self->respond( template => 'index.tt2.html', data => { - errors => [ "internal" ] + content => 'errors.tt2.html', + errors => [ "internal" ] } ); } @@ -602,7 +627,8 @@ sub req_create_accounts { $self->respond( template => 'index.tt2.html', data => { - errors => [ "accounts_creation_failed" ] + content => 'errors.tt2.html', + errors => [ "accounts_creation_failed" ] } ); } @@ -627,7 +653,8 @@ sub req_create_accounts { $self->respond( template => 'index.tt2.html', data => { - errors => [ "accounts_creation_failed" ] + content => 'errors.tt2.html', + errors => [ "accounts_creation_failed" ] } ); } @@ -645,7 +672,7 @@ sub req_create_accounts { entityid => $self->{in}->{entityid}, key => $key, token => $download_token->token(), - action => 'create_accounts' + content => 'create_accounts.tt2.html' } ); } @@ -658,7 +685,8 @@ sub req_download_accounts { $self->respond( template => 'index.tt2.html', data => { - errors => [ "missing_entityid" ] + content => 'errors.tt2.html', + errors => [ "missing_entityid" ] } ); } @@ -668,7 +696,8 @@ sub req_download_accounts { $self->respond( template => 'index.tt2.html', data => { - errors => [ "missing_token" ] + content => 'errors.tt2.html', + errors => [ "missing_token" ] } ); } @@ -678,7 +707,8 @@ sub req_download_accounts { $self->respond( template => 'index.tt2.html', data => { - errors => [ "missing_key" ] + content => 'errors.tt2.html', + errors => [ "missing_key" ] } ); } @@ -696,7 +726,8 @@ sub req_download_accounts { $self->respond( template => 'index.tt2.html', data => { - errors => [ "wrong_token" ] + content => 'errors.tt2.html', + errors => [ "wrong_token" ] } ); } @@ -710,7 +741,8 @@ sub req_download_accounts { $self->respond( template => 'index.tt2.html', data => { - errors => [ "wrong_token_for_sp" ] + content => 'errors.tt2.html', + errors => [ "wrong_token_for_sp" ] } ); } @@ -784,7 +816,7 @@ sub req_home { $self->respond( template => 'index.tt2.html', data => { - action => 'home' + content => 'home.tt2.html' } ); } diff --git a/templates/Makefile.am b/templates/Makefile.am index 7a2d9502f005021459d0a76e7be7e222ab45575f..60d93b7633d5687cb4113a0f5df8c62963755420 100644 --- a/templates/Makefile.am +++ b/templates/Makefile.am @@ -1,22 +1,18 @@ nobase_templates_DATA = \ accountProfiles/valid-accounts.php.tt2 \ mail/send_authentication_token.tt2.eml \ - web/en/content.tt2.html \ web/en/errors.tt2.html \ web/en/home.tt2.html \ web/en/index.tt2.html \ web/en/index-nobanner.tt2.html \ - web/en/notices.tt2.html \ web/en/select_sp.tt2.html \ web/en/select_email.tt2.html \ web/en/complete_challenge.tt2.html \ web/en/create_accounts.tt2.html \ - web/fr/content.tt2.html \ web/fr/errors.tt2.html \ web/fr/home.tt2.html \ web/fr/index.tt2.html \ web/fr/index-nobanner.tt2.html \ - web/fr/notices.tt2.html \ web/fr/select_sp.tt2.html \ web/fr/select_email.tt2.html \ web/fr/complete_challenge.tt2.html \ diff --git a/templates/web/en/content.tt2.html b/templates/web/en/content.tt2.html deleted file mode 100644 index 6327b7bd55eeb40078d5dada9a1b98b8d43cdaec..0000000000000000000000000000000000000000 --- a/templates/web/en/content.tt2.html +++ /dev/null @@ -1,41 +0,0 @@ - - -[% IF action == 'select_sp' %] - [% TRY %] - [% PROCESS 'select_sp.tt2.html' %] - [% CATCH %] - An error occured - [% END %] - - [% ELSIF action == 'select_email' %] - [% TRY %] - [% PROCESS 'select_email.tt2.html' %] - [% CATCH %] - An error occured - [% END %] - -[% ELSIF action == 'complete_challenge' %] - [% TRY %] - [% PROCESS 'complete_challenge.tt2.html' %] - [% CATCH %] - An error occured - [% END %] - -[% ELSIF action == 'create_accounts' %] - [% TRY %] - [% PROCESS 'create_accounts.tt2.html' %] - [% CATCH %] - An error occured - [% END %] - - [% ELSIF action == 'home' %] - [% TRY %] - [% PROCESS 'home.tt2.html' %] - [% CATCH %] - An error occured - [% END %] - -[% ELSE %] -Error: unknown action - -[% END %] diff --git a/templates/web/en/index-nobanner.tt2.html b/templates/web/en/index-nobanner.tt2.html index f13a0d1f4ebff4f201ea317b518a32901db50c4c..95391987ae3ac1fd634a1ece4eb5cda8aee3afe3 100644 --- a/templates/web/en/index-nobanner.tt2.html +++ b/templates/web/en/index-nobanner.tt2.html @@ -1,9 +1,3 @@ <DOCTYPE! html> -[% IF errors %] -<div class="ui-widget"> -[% PROCESS 'errors.tt2.html' %] -</div> -[% ELSE %] -[% PROCESS 'content.tt2.html' %] -[% END %] +[% INCLUDE $content %] diff --git a/templates/web/en/index.tt2.html b/templates/web/en/index.tt2.html index 9e474006136c46310872f121c281cbadd9bbecce..74a34cd9443bef55066dcfc99b60a8a842f23172 100644 --- a/templates/web/en/index.tt2.html +++ b/templates/web/en/index.tt2.html @@ -34,12 +34,7 @@ </header> <main> - - [% IF errors %] - [% PROCESS 'errors.tt2.html' %] - [% ELSE %] - [% PROCESS 'content.tt2.html' %] - [% END %] + [% INCLUDE $content %] </main> <footer> diff --git a/templates/web/fr/content.tt2.html b/templates/web/fr/content.tt2.html deleted file mode 100644 index 6327b7bd55eeb40078d5dada9a1b98b8d43cdaec..0000000000000000000000000000000000000000 --- a/templates/web/fr/content.tt2.html +++ /dev/null @@ -1,41 +0,0 @@ - - -[% IF action == 'select_sp' %] - [% TRY %] - [% PROCESS 'select_sp.tt2.html' %] - [% CATCH %] - An error occured - [% END %] - - [% ELSIF action == 'select_email' %] - [% TRY %] - [% PROCESS 'select_email.tt2.html' %] - [% CATCH %] - An error occured - [% END %] - -[% ELSIF action == 'complete_challenge' %] - [% TRY %] - [% PROCESS 'complete_challenge.tt2.html' %] - [% CATCH %] - An error occured - [% END %] - -[% ELSIF action == 'create_accounts' %] - [% TRY %] - [% PROCESS 'create_accounts.tt2.html' %] - [% CATCH %] - An error occured - [% END %] - - [% ELSIF action == 'home' %] - [% TRY %] - [% PROCESS 'home.tt2.html' %] - [% CATCH %] - An error occured - [% END %] - -[% ELSE %] -Error: unknown action - -[% END %] diff --git a/templates/web/fr/index-nobanner.tt2.html b/templates/web/fr/index-nobanner.tt2.html index f13a0d1f4ebff4f201ea317b518a32901db50c4c..95391987ae3ac1fd634a1ece4eb5cda8aee3afe3 100644 --- a/templates/web/fr/index-nobanner.tt2.html +++ b/templates/web/fr/index-nobanner.tt2.html @@ -1,9 +1,3 @@ <DOCTYPE! html> -[% IF errors %] -<div class="ui-widget"> -[% PROCESS 'errors.tt2.html' %] -</div> -[% ELSE %] -[% PROCESS 'content.tt2.html' %] -[% END %] +[% INCLUDE $content %] diff --git a/templates/web/fr/index.tt2.html b/templates/web/fr/index.tt2.html index ebfd655e7fd8c9d279a8ebc126b3682e7d1ee199..86e8aa0b1d8abda08a593b795a024981571c7468 100644 --- a/templates/web/fr/index.tt2.html +++ b/templates/web/fr/index.tt2.html @@ -34,11 +34,7 @@ </header> <main> - [% IF errors %] - [% PROCESS 'errors.tt2.html' %] - [% ELSE %] - [% PROCESS 'content.tt2.html' %] - [% END %] + [% INCLUDE $content %] </main> <footer>