diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Display.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Display.pm index 7b66599e3..18e5909c5 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Display.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Display.pm @@ -10,6 +10,11 @@ use Mouse; use JSON; use Data::Dumper; +use constant CommonPrms => { + MAIN_LOGO => 'portalMainLogo', + LANGS => 'showLanguages', +}; + has skinRules => ( is => 'rw' ); has favAppsRule => ( is => 'rw', default => sub { 1 } ); @@ -60,8 +65,6 @@ sub display { $self->logger->debug('Display: notification detected'); $skinfile = 'notification'; %templateParams = ( - MAIN_LOGO => $self->conf->{portalMainLogo}, - LANGS => $self->conf->{showLanguages}, AUTH_ERROR_TYPE => $req->error_type, NOTIFICATION => $notif, HIDDEN_INPUTS => $self->buildHiddenForm($req), @@ -82,8 +85,6 @@ sub display { $self->logger->debug('Display: confirm detected'); $skinfile = 'confirm'; %templateParams = ( - MAIN_LOGO => $self->conf->{portalMainLogo}, - LANGS => $self->conf->{showLanguages}, AUTH_ERROR => $req->error, AUTH_ERROR_TYPE => $req->error_type, AUTH_URL => $req->{data}->{_url}, @@ -112,8 +113,6 @@ sub display { $self->logger->debug('Display: IDP choice detected'); $skinfile = 'idpchoice'; %templateParams = ( - MAIN_LOGO => $self->conf->{portalMainLogo}, - LANGS => $self->conf->{showLanguages}, AUTH_ERROR => $req->error, AUTH_ERROR_TYPE => $req->error_type, AUTH_URL => $req->{data}->{_url}, @@ -143,8 +142,6 @@ sub display { 'Hidden values -> ' . Dumper( $req->{portalHiddenFormValues} ) ); $skinfile = 'info'; %templateParams = ( - MAIN_LOGO => $self->conf->{portalMainLogo}, - LANGS => $self->conf->{showLanguages}, AUTH_ERROR => $self->error, AUTH_ERROR_TYPE => $req->error_type, MSG => $info, @@ -172,8 +169,6 @@ sub display { my $id = $req->{sessionInfo} ->{ $self->conf->{openIdAttr} || $self->conf->{whatToTrace} }; %templateParams = ( - MAIN_LOGO => $self->conf->{portalMainLogo}, - LANGS => $self->conf->{showLanguages}, AUTH_ERROR => $self->error, AUTH_ERROR_TYPE => $req->error_type, PROVIDERURI => $p, @@ -210,8 +205,6 @@ sub display { #utf8::decode($auth_user); %templateParams = ( - MAIN_LOGO => $self->conf->{portalMainLogo}, - LANGS => $self->conf->{showLanguages}, AUTH_USER => $req->{sessionInfo}->{ $self->conf->{portalUserAttr} }, NEWWINDOW => $self->conf->{portalOpenLinkInNewWindow}, LOGOUT_URL => $self->conf->{portal} . "?logout=1", @@ -232,8 +225,6 @@ sub display { elsif ( $req->error == PE_RENEWSESSION ) { $skinfile = 'upgradesession'; %templateParams = ( - MAIN_LOGO => $self->conf->{portalMainLogo}, - LANGS => $self->conf->{showLanguages}, MSG => 'askToRenew', CONFIRMKEY => $self->stamp, PORTAL => $self->conf->{portal}, @@ -249,8 +240,6 @@ sub display { elsif ( $req->error == PE_MUSTAUTHN ) { $skinfile = 'updatesession'; %templateParams = ( - MAIN_LOGO => $self->conf->{portalMainLogo}, - LANGS => $self->conf->{showLanguages}, MSG => 'PE87', CONFIRMKEY => $self->stamp, PORTAL => $self->conf->{portal}, @@ -273,8 +262,6 @@ sub display { { $skinfile = 'error'; %templateParams = ( - MAIN_LOGO => $self->conf->{portalMainLogo}, - LANGS => $self->conf->{showLanguages}, AUTH_ERROR => $req->error, AUTH_ERROR_TYPE => $req->error_type, ( @@ -292,8 +279,6 @@ sub display { my $login = $self->userId($req); $login = '' if ( $login eq 'anonymous' ); %templateParams = ( - MAIN_LOGO => $self->conf->{portalMainLogo}, - LANGS => $self->conf->{showLanguages}, AUTH_ERROR => $req->error, AUTH_ERROR_TYPE => $req->error_type, AUTH_URL => $req->{data}->{_url}, @@ -332,6 +317,10 @@ sub display { $filter->{LOGIN_FORM} = $form; } } + # Common parameters + foreach (keys %{CommonPrms()}){ + $templateParams{$_} = $self->conf->{CommonPrms->{$_}}; + } $self->logger->debug("Calling sendHtml with template $skinfile"); return $self->sendHtml(