Move OIDC HTML fragments to tpl (#1302)

This commit is contained in:
Xavier Guimard 2017-10-11 11:51:50 +00:00
parent 91af1f63ff
commit 6072a31152
4 changed files with 44 additions and 17 deletions

View File

@ -275,6 +275,8 @@ site/templates/bootstrap/menuCat.tpl
site/templates/bootstrap/noHistory.tpl
site/templates/bootstrap/notification.tpl
site/templates/bootstrap/oidcConsents.tpl
site/templates/bootstrap/oidcGiveConsent.tpl
site/templates/bootstrap/oidcLogout.tpl
site/templates/bootstrap/openid.tpl
site/templates/bootstrap/openidform.tpl
site/templates/bootstrap/password.tpl

View File

@ -440,23 +440,15 @@ sub run {
->{oidcRPMetaDataOptionsDisplayName};
my $icon = $self->conf->{oidcRPMetaDataOptions}->{$rp}
->{oidcRPMetaDataOptionsIcon};
my $img_src;
my $imgSrc;
if ($icon) {
$img_src =
$imgSrc =
( $icon =~ m#^https?://# )
? $icon
: $self->p->staticPrefic . "/common/" . $icon;
}
# HERE
$req->info('<div class="oidc_consent_message">');
$req->info( '<img src="' . $img_src . '" />' )
if $img_src;
$req->info(
qq'<h3 trspan="oidcConsent,$display_name">The application $display_name would like to know:</h3><ul>'
);
my $scope_messages = {
openid => 'yourIdentity',
profile => 'yourProfile',
@ -464,14 +456,32 @@ qq'<h3 trspan="oidcConsent,$display_name">The application $display_name would li
address => 'yourAddress',
phone => 'yourPhone',
};
my @list;
foreach my $requested_scope (
split( /\s/, $oidc_request->{'scope'} ) )
{
my $message = $scope_messages->{$requested_scope}
|| 'anotherInformation';
$req->info(qq'<li trspan="$message">$message</li>');
if ( my $message =
$scope_messages->{$requested_scope} )
{
push @list, { m => $message };
}
else {
push @list,
{
m => 'anotherInformation',
n => $requested_scope
};
}
}
$req->info('</ul></div>');
$req->info(
$self->loadTemplate(
'oidcGiveConsent',
params => {
imgUrl => $imgSrc,
list => \@list,
}
)
);
$req->datas->{activeTimer} = 0;
return PE_CONFIRM;
}
@ -834,9 +844,7 @@ qq'<h3 trspan="oidcConsent,$display_name">The application $display_name would li
: PE_OK;
}
$req->info(
'<div class="oidc_logout_message"><h3 trspan="logoutConfirm">Do you want to logout?</h3></div>'
);
$req->info( $self->loadTemplate('oidcLogout') );
$req->datas->{activeTimer} = 0;
return PE_CONFIRM;
}

View File

@ -0,0 +1,16 @@
<div class="oidc_consent_message">
<TMPL_IF NAME="imgUrl">
<img src="<TMPL_VAR NAME="imgUrl">" />
</TMPL_IF>
<h3 trspan="oidcConsent,$display_name"></h3>
<ul>
<TMPL_LOOP NAME="list">
<li>
<span trspan="<TMPL_VAR NAME="m">"><TMPL_VAR NAME="m"></span>
<TMPL_IF NAME="n">
<i>(<TMPL_VAR NAME="n">)</i>
</TMPL_IF>
</li>
</TMPL_LOOP>
</ul>
</div>

View File

@ -0,0 +1 @@
<div class="oidc_logout_message"><h3 trspan="logoutConfirm">Do you want to logout?</h3></div>