Display user friendly messages for scope consent (#184)

This commit is contained in:
Clément Oudot 2015-03-11 14:34:31 +00:00
parent 495da0dde5
commit f3dcec7ad7
3 changed files with 48 additions and 4 deletions

View File

@ -406,8 +406,26 @@ sub issuerForAuthUser {
. '</h3>' );
$self->info('<ul>');
foreach ( split( /\s/, $oidc_request->{'scope'} ) ) {
$self->info("<li>$_</li>");
foreach my $requested_scope (
split( /\s/, $oidc_request->{'scope'} ) )
{
my $message;
my $scope_messages = {
openid => PM_OIDC_SCOPE_OPENID,
profile => PM_OIDC_SCOPE_PROFILE,
email => PM_OIDC_SCOPE_EMAIL,
address => PM_OIDC_SCOPE_ADDRESS,
phone => PM_OIDC_SCOPE_PHONE,
};
if ( $scope_messages->{$requested_scope} ) {
$message =
$self->msg( $scope_messages->{$requested_scope} );
}
else {
$message = $self->msg(PM_OIDC_SCOPE_OTHER) . " "
. $requested_scope;
}
$self->info("<li>$message</li>");
}
$self->info('</ul>');
$self->info('</div>');

View File

@ -185,6 +185,12 @@ use constant {
PM_LAST_LOGINS => 22,
PM_LAST_FAILED_LOGINS => 23,
PM_OIDC_CONSENT => 24,
PM_OIDC_SCOPE_OPENID => 25,
PM_OIDC_SCOPE_PROFILE => 26,
PM_OIDC_SCOPE_EMAIL => 27,
PM_OIDC_SCOPE_ADDRESS => 28,
PM_OIDC_SCOPE_PHONE => 29,
PM_OIDC_SCOPE_OTHER => 30,
};
# EXPORTER PARAMETERS
@ -214,7 +220,9 @@ our @EXPORT = qw( PE_IMG_NOK PE_IMG_OK PE_INFO PE_REDIRECT PE_DONE PE_OK
PM_SAML_IDPSELECT PM_SAML_IDPCHOOSEN PM_REMEMBERCHOICE PM_SAML_SPLOGOUT
PM_REDIRECTION PM_BACKTOSP PM_BACKTOCASURL PM_LOGOUT PM_OPENID_EXCHANGE
PM_CDC_WRITER PM_OPENID_RPNS PM_OPENID_PA PM_OPENID_AP PM_ERROR_MSG
PM_LAST_LOGINS PM_LAST_FAILED_LOGINS PM_OIDC_CONSENT
PM_LAST_LOGINS PM_LAST_FAILED_LOGINS PM_OIDC_CONSENT PM_OIDC_SCOPE_OPENID
PM_OIDC_SCOPE_PROFILE PM_OIDC_SCOPE_EMAIL PM_OIDC_SCOPE_ADDRESS
PM_OIDC_SCOPE_PHONE PM_OIDC_SCOPE_OTHER
);
our %EXPORT_TAGS = ( 'all' => [ @EXPORT, 'import' ], );

View File

@ -427,6 +427,12 @@ sub error_ro {
# * PM_LAST_LOGINS 22
# * PM_LAST_FAILED_LOGINS 23
# * PM_OIDC_CONSENT 24
# * PM_OIDC_SCOPE_OPENID 25
# * PM_OIDC_SCOPE_PROFILE 26
# * PM_OIDC_SCOPE_EMAIL 27
# * PM_OIDC_SCOPE_ADDRESS 28
# * PM_OIDC_SCOPE_PHONE 29
# * PM_OIDC_SCOPE_OTHER 30
sub msg_en {
use utf8;
@ -455,7 +461,13 @@ sub msg_en {
'Error Message',
'Your last logins',
'Your last failed logins',
'Application %s would like to know:',
'The application %s would like to know:',
'Your identity',
'Your profile',
'Your email',
'Your address',
'Your phone number',
'Another information:',
];
}
@ -487,6 +499,12 @@ sub msg_fr {
'Vos dernières connexions',
'Vos dernières connexions refusées',
'L\'application %s voudrait connaître :',
'Votre identité',
'Vos informations personnelles',
'Votre adresse électronique',
'Votre adresse',
'Votre numéro de téléphone',
'Une autre information :',
];
}