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

templates simplification: chomp by default

parent e7a0ae00
No related branches found
No related tags found
No related merge requests found
......@@ -10,6 +10,7 @@ use HTTP::AcceptLanguage;
use Log::Any::Adapter;
use List::MoreUtils qw(uniq);
use Template;
use Template::Constants qw(:chomp);
use Text::CSV;
use AccountManager::Account;
......@@ -179,7 +180,8 @@ sub respond {
## Parse template
my $tt2 = Template->new({
ENCODING => 'utf8',
ENCODING => 'utf8',
PRE_CHOMP => CHOMP_ONE,
INCLUDE_PATH => $self->{configuration}->{setup}->{templates_dir} . "/web/$lang"
});
......@@ -480,7 +482,8 @@ sub req_complete_challenge {
my $lang = HTTP::AcceptLanguage->new($ENV{HTTP_ACCEPT_LANGUAGE})->match(qw/en fr/) || 'en';
my $tt2 = Template->new({
ENCODING => 'utf8',
ENCODING => 'utf8',
PRE_CHOMP => CHOMP_ONE,
INCLUDE_PATH => $self->{configuration}->{setup}->{templates_dir} . "/mail/$lang"
});
my $template = 'send_authentication_token.tt2.eml';
......
......@@ -10,6 +10,7 @@ use List::Util qw(shuffle);
use List::MoreUtils qw(pairwise);
use MIME::Base64;
use Template;
use Template::Constants qw(:chomp);
use Template::Stash;
sub encrypt {
......@@ -109,6 +110,7 @@ sub update_ssp_authsources {
my $tt2 = Template->new({
ENCODING => 'utf8',
PRE_CHOMP => CHOMP_ONE,
INCLUDE_PATH => $templates_dir . '/accounts'
});
my $template = 'accounts.php.tt2';
......
......@@ -3,41 +3,41 @@
$validTestAccounts = array (
'authcrypt:Hash',
[% FOREACH account IN accounts -%]
[% FOREACH account IN accounts %]
'user[% account.id() %]:{SHA256}[% account.password_hash() %]=' => array(
'internal_uid' => array([% account.internal_uid().quote %]),
'associatedSP' => array([% account.associatedSP().quote %]),
[% IF account.cn() -%]
[% IF account.cn() %]
'cn' => array([% account.cn().quote %]),
[% END -%]
[% IF account.sn() -%]
[% END %]
[% IF account.sn() %]
'sn' => array([% account.sn().quote %]),
[% END -%]
[% IF account.displayName() -%]
[% END %]
[% IF account.displayName() %]
'displayName' => array([% account.displayName().quote %]),
[% END -%]
[% IF account.givenName() -%]
[% END %]
[% IF account.givenName() %]
'givenName' => array([% account.givenName().quote %]),
[% END -%]
[% IF account.mail() -%]
[% END %]
[% IF account.mail() %]
'mail' => array([% account.mail().quote %]),
[% END -%]
[% IF account.eduPersonAffiliation() -%]
[% END %]
[% IF account.eduPersonAffiliation() %]
'eduPersonAffiliation' => array([% account.eduPersonAffiliation().quote.join(', ') %]),
[% END -%]
[% IF account.eduPersonScopedAffiliation() -%]
[% END %]
[% IF account.eduPersonScopedAffiliation() %]
'eduPersonScopedAffiliation' => array([% account.eduPersonScopedAffiliation().quote.join(', ') %]),
[% END -%]
[% IF account.eduPersonPrincipalName() -%]
[% END %]
[% IF account.eduPersonPrincipalName() %]
'eduPersonPrincipalName' => array([% account.eduPersonPrincipalName().quote %]),
[% END -%]
[% IF account.schacHomeOrganization() -%]
[% END %]
[% IF account.schacHomeOrganization() %]
'schacHomeOrganization' => array([% account.schacHomeOrganization().quote %]),
[% END -%]
[% IF account.schacHomeOrganizationType() -%]
[% END %]
[% IF account.schacHomeOrganizationType() %]
'schacHomeOrganizationType' => array([% account.schacHomeOrganizationType().quote %]),
[% END -%]
[% END %]
),
[% END -%]
[% END %]
);
......@@ -49,14 +49,14 @@ provider.</p>
<div>
<table>
<caption>List of user attributes</caption>
[% FOREACH attribute IN [ 'cn', 'displayName', 'givenName', 'sn', 'mail', 'schacHomeOrganization', 'schacHomeOrganizationType', 'eduPersonPrincipalName' ] -%]
[% FOREACH attribute IN [ 'cn', 'displayName', 'givenName', 'sn', 'mail', 'schacHomeOrganization', 'schacHomeOrganizationType', 'eduPersonPrincipalName' ] %]
<tr>
<th>[% attribute %]</th><td> [% account.$attribute() %]</td>
<th>[% attribute %]</th><td>[% account.$attribute() %]</td>
</tr>
[% END %]
[% FOREACH attribute IN [ 'eduPersonAffiliation', 'eduPersonScopedAffiliation' ] -%]
[% FOREACH attribute IN [ 'eduPersonAffiliation', 'eduPersonScopedAffiliation' ] %]
<tr>
<th>[% attribute %]</th><td> [% account.$attribute().join(', ') %]</td>
<th>[% attribute %]</th><td>[% account.$attribute().join(', ') %]</td>
</tr>
[% END %]
<tr>
......
......@@ -51,14 +51,14 @@ service fédéré. Pour le faire, sélectionnez <strong>[% idp_displayname
<div>
<table>
<caption>Liste des attributs utilisateur</caption>
[% FOREACH attribute IN [ 'cn', 'displayName', 'givenName', 'sn', 'mail', 'schacHomeOrganization', 'schacHomeOrganizationType', 'eduPersonPrincipalName' ] -%]
[% FOREACH attribute IN [ 'cn', 'displayName', 'givenName', 'sn', 'mail', 'schacHomeOrganization', 'schacHomeOrganizationType', 'eduPersonPrincipalName' ] %]
<tr>
<th>[% attribute %]</th><td> [% account.$attribute() %]</td>
<th>[% attribute %]</th><td>[% account.$attribute() %]</td>
</tr>
[% END %]
[% FOREACH attribute IN [ 'eduPersonAffiliation', 'eduPersonScopedAffiliation' ] -%]
[% FOREACH attribute IN [ 'eduPersonAffiliation', 'eduPersonScopedAffiliation' ] %]
<tr>
<th>[% attribute %]</th><td> [% account.$attribute().join(', ') %]</td>
<th>[% attribute %]</th><td>[% account.$attribute().join(', ') %]</td>
</tr>
[% END %]
<tr>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment