Code refactoring (#2749)
This commit is contained in:
parent
cc3f433136
commit
2f1d2a5e3b
|
@ -2,7 +2,7 @@
|
|||
# Display functions for LemonLDAP::NG Portal
|
||||
package Lemonldap::NG::Portal::Main::Display;
|
||||
|
||||
our $VERSION = '2.0.14';
|
||||
our $VERSION = '2.0.15';
|
||||
|
||||
package Lemonldap::NG::Portal::Main;
|
||||
use strict;
|
||||
|
@ -92,8 +92,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,
|
||||
AUTH_ERROR_ROLE => $req->error_role,
|
||||
NOTIFICATION => $notif,
|
||||
|
@ -115,8 +113,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_ERROR_ROLE => $req->error_role,
|
||||
|
@ -147,8 +143,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_ERROR_ROLE => $req->error_role,
|
||||
|
@ -182,8 +176,6 @@ sub display {
|
|||
for keys %{ $req->{portalHiddenFormValues} // {} };
|
||||
$skinfile = 'info';
|
||||
%templateParams = (
|
||||
MAIN_LOGO => $self->conf->{portalMainLogo},
|
||||
LANGS => $self->conf->{showLanguages},
|
||||
AUTH_ERROR => $self->error,
|
||||
AUTH_ERROR_TYPE => $req->error_type,
|
||||
AUTH_ERROR_ROLE => $req->error_role,
|
||||
|
@ -216,8 +208,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,
|
||||
AUTH_ERROR_ROLE => $req->error_role,
|
||||
|
@ -239,8 +229,6 @@ sub display {
|
|||
my $method = $req->data->{redirectFormMethod} || 'get';
|
||||
$skinfile = "redirect";
|
||||
%templateParams = (
|
||||
MAIN_LOGO => $self->conf->{portalMainLogo},
|
||||
LANGS => $self->conf->{showLanguages},
|
||||
URL => $req->{urldc},
|
||||
HIDDEN_INPUTS => $self->buildOutgoingHiddenForm( $req, $method ),
|
||||
FORM_METHOD => $method,
|
||||
|
@ -258,14 +246,11 @@ 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",
|
||||
APPSLIST_ORDER => $req->{sessionInfo}->{'_appsListOrder'},
|
||||
PING => $self->conf->{portalPingInterval},
|
||||
SCROLL_TOP => $self->conf->{scrollTop},
|
||||
DONT_STORE_PASSWORD => $self->conf->{browsersDontStorePassword},
|
||||
HIDE_OLDPASSWORD => 0,
|
||||
PPOLICY_NOPOLICY => !$self->isPP(),
|
||||
|
@ -301,8 +286,6 @@ sub display {
|
|||
elsif ( $req->error == PE_UPGRADESESSION ) {
|
||||
$skinfile = 'upgradesession';
|
||||
%templateParams = (
|
||||
MAIN_LOGO => $self->conf->{portalMainLogo},
|
||||
LANGS => $self->conf->{showLanguages},
|
||||
FORMACTION => '/upgradesession',
|
||||
MSG => 'askToUpgrade',
|
||||
PORTALBUTTON => 1,
|
||||
|
@ -322,8 +305,6 @@ sub display {
|
|||
elsif ( $req->error == PE_RENEWSESSION ) {
|
||||
$skinfile = 'upgradesession';
|
||||
%templateParams = (
|
||||
MAIN_LOGO => $self->conf->{portalMainLogo},
|
||||
LANGS => $self->conf->{showLanguages},
|
||||
FORMACTION => '/renewsession',
|
||||
MSG => 'askToRenew',
|
||||
CONFIRMKEY => $self->stamp,
|
||||
|
@ -343,8 +324,6 @@ sub display {
|
|||
elsif ( $req->error == PE_MUSTAUTHN ) {
|
||||
$skinfile = 'upgradesession';
|
||||
%templateParams = (
|
||||
MAIN_LOGO => $self->conf->{portalMainLogo},
|
||||
LANGS => $self->conf->{showLanguages},
|
||||
FORMACTION => '/renewsession',
|
||||
MSG => 'PE87',
|
||||
CONFIRMKEY => $self->stamp,
|
||||
|
@ -377,8 +356,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,
|
||||
AUTH_ERROR_ROLE => $req->error_role,
|
||||
|
@ -396,8 +373,6 @@ sub display {
|
|||
$skinfile = 'login';
|
||||
my $login = $req->user;
|
||||
%templateParams = (
|
||||
MAIN_LOGO => $self->conf->{portalMainLogo},
|
||||
LANGS => $self->conf->{showLanguages},
|
||||
AUTH_ERROR => $req->error,
|
||||
AUTH_ERROR_TYPE => $req->error_type,
|
||||
AUTH_ERROR_ROLE => $req->error_role,
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#
|
||||
package Lemonldap::NG::Portal::Main::Run;
|
||||
|
||||
our $VERSION = '2.0.14';
|
||||
our $VERSION = '2.0.15';
|
||||
|
||||
package Lemonldap::NG::Portal::Main;
|
||||
|
||||
|
@ -1044,8 +1044,12 @@ sub tplParams {
|
|||
}
|
||||
|
||||
return (
|
||||
SKIN => $self->getSkin($req),
|
||||
PORTAL_URL => $self->conf->{portal},
|
||||
SCROLL_TOP => $self->conf->{scrollTop},
|
||||
MAIN_LOGO => $self->conf->{portalMainLogo},
|
||||
LANGS => $self->conf->{showLanguages},
|
||||
SCROLL_TOP => $self->conf->{scrollTop},
|
||||
SKIN => $self->getSkin($req),
|
||||
SKIN_PATH => $portalPath . "skins",
|
||||
SAMESITE => getSameSite( $self->conf ),
|
||||
SKIN_BG => $self->conf->{portalSkinBackground},
|
||||
|
|
|
@ -65,11 +65,6 @@ sub display {
|
|||
|
||||
# Display form
|
||||
my $params = {
|
||||
PORTAL => $self->conf->{portal},
|
||||
MAIN_LOGO => $self->conf->{portalMainLogo},
|
||||
SKIN => $self->p->getSkin($req),
|
||||
LANGS => $self->conf->{showLanguages},
|
||||
SCROLL_TOP => $self->conf->{scrollTop},
|
||||
DOWNLOAD => $self->conf->{checkDevOpsDownload},
|
||||
MSG => 'checkDevOps',
|
||||
ALERTE => 'alert-info',
|
||||
|
@ -111,10 +106,6 @@ sub parse {
|
|||
|
||||
# Prepare form
|
||||
my $params = {
|
||||
PORTAL => $self->conf->{portal},
|
||||
MAIN_LOGO => $self->conf->{portalMainLogo},
|
||||
SKIN => $self->p->getSkin($req),
|
||||
LANGS => $self->conf->{showLanguages},
|
||||
DOWNLOAD => $self->conf->{checkDevOpsDownload},
|
||||
MSG => "PE$msg",
|
||||
ALERTE => 'alert-warning',
|
||||
|
@ -305,10 +296,6 @@ sub parse {
|
|||
|
||||
# Prepare form
|
||||
my $params = {
|
||||
PORTAL => $self->conf->{portal},
|
||||
MAIN_LOGO => $self->conf->{portalMainLogo},
|
||||
SKIN => $self->p->getSkin($req),
|
||||
LANGS => $self->conf->{showLanguages},
|
||||
DOWNLOAD => $self->conf->{checkDevOpsDownload},
|
||||
MSG => $msg,
|
||||
UNKNOWN => join( $self->conf->{multiValuesSeparator}, @$unknown ),
|
||||
|
|
|
@ -159,11 +159,6 @@ sub display {
|
|||
$self->_createArray( $req, $attrs, $req->userData ) );
|
||||
|
||||
my $params = {
|
||||
PORTAL => $self->conf->{portal},
|
||||
MAIN_LOGO => $self->conf->{portalMainLogo},
|
||||
SKIN => $self->p->getSkin($req),
|
||||
LANGS => $self->conf->{showLanguages},
|
||||
SCROLL_TOP => $self->conf->{scrollTop},
|
||||
MSG => 'checkUser' . $self->merged,
|
||||
ALERTE => ( $self->merged ? 'alert-warning' : 'alert-info' ),
|
||||
LOGIN => $req->{userData}->{ $self->conf->{whatToTrace} },
|
||||
|
@ -211,11 +206,6 @@ sub check {
|
|||
}
|
||||
|
||||
my $params = {
|
||||
PORTAL => $self->conf->{portal},
|
||||
MAIN_LOGO => $self->conf->{portalMainLogo},
|
||||
SKIN => $self->p->getSkin($req),
|
||||
LANGS => $self->conf->{showLanguages},
|
||||
SCROLL_TOP => $self->conf->{scrollTop},
|
||||
MSG => "PE$msg",
|
||||
ALERTE => 'alert-warning',
|
||||
LOGIN => '',
|
||||
|
@ -243,11 +233,6 @@ sub check {
|
|||
$req,
|
||||
'checkuser',
|
||||
params => {
|
||||
PORTAL => $self->conf->{portal},
|
||||
MAIN_LOGO => $self->conf->{portalMainLogo},
|
||||
SKIN => $self->p->getSkin($req),
|
||||
LANGS => $self->conf->{showLanguages},
|
||||
SCROLL_TOP => $self->conf->{scrollTop},
|
||||
MSG => 'PE' . PE_MALFORMEDUSER,
|
||||
ALERTE => 'alert-warning',
|
||||
LOGIN => '',
|
||||
|
@ -412,11 +397,6 @@ sub check {
|
|||
|
||||
# TODO:
|
||||
my $params = {
|
||||
PORTAL => $self->conf->{portal},
|
||||
MAIN_LOGO => $self->conf->{portalMainLogo},
|
||||
SKIN => $self->p->getSkin($req),
|
||||
LANGS => $self->conf->{showLanguages},
|
||||
SCROLL_TOP => $self->conf->{scrollTop},
|
||||
MSG => $msg,
|
||||
ALERTE => ( $msg eq 'checkUser' ? 'alert-info' : 'alert-warning' ),
|
||||
LOGIN => $user,
|
||||
|
|
|
@ -14,7 +14,7 @@ use Lemonldap::NG::Portal::Main::Constants qw(
|
|||
PE_IMPERSONATION_SERVICE_NOT_ALLOWED
|
||||
);
|
||||
|
||||
our $VERSION = '2.0.10';
|
||||
our $VERSION = '2.0.15';
|
||||
|
||||
extends qw(
|
||||
Lemonldap::NG::Portal::Main::Plugin
|
||||
|
@ -119,10 +119,6 @@ sub display {
|
|||
|
||||
# Display form
|
||||
my $params = {
|
||||
PORTAL => $self->conf->{portal},
|
||||
MAIN_LOGO => $self->conf->{portalMainLogo},
|
||||
SKIN => $self->p->getSkin($req),
|
||||
LANGS => $self->conf->{showLanguages},
|
||||
MSG => 'contextSwitching_ON',
|
||||
ALERTE => 'alert-danger',
|
||||
IMPERSONATION => $self->conf->{contextSwitchingRule},
|
||||
|
|
|
@ -12,7 +12,7 @@ use Lemonldap::NG::Portal::Main::Constants qw(
|
|||
PE_SENDRESPONSE
|
||||
);
|
||||
|
||||
our $VERSION = '2.0.14';
|
||||
our $VERSION = '2.0.15';
|
||||
|
||||
extends qw(
|
||||
Lemonldap::NG::Portal::Main::Plugin
|
||||
|
@ -89,10 +89,6 @@ sub run {
|
|||
$req,
|
||||
'globallogout',
|
||||
params => {
|
||||
PORTAL => $self->conf->{portal},
|
||||
MAIN_LOGO => $self->conf->{portalMainLogo},
|
||||
SKIN => $self->p->getSkin($req),
|
||||
LANGS => $self->conf->{showLanguages},
|
||||
SESSIONS => $sessions,
|
||||
TOKEN => $token,
|
||||
LOGIN => $user,
|
||||
|
|
|
@ -189,11 +189,6 @@ sub myNotifs {
|
|||
|
||||
# Build template
|
||||
my $params = {
|
||||
PORTAL => $self->conf->{portal},
|
||||
MAIN_LOGO => $self->conf->{portalMainLogo},
|
||||
SKIN => $self->p->getSkin($req),
|
||||
LANGS => $self->conf->{showLanguages},
|
||||
SCROLL_TOP => $self->conf->{scrollTop},
|
||||
NOTIFICATIONS => $_notifications,
|
||||
MSG => $msg
|
||||
};
|
||||
|
|
|
@ -84,14 +84,11 @@ sub ask {
|
|||
$req,
|
||||
'upgradesession',
|
||||
params => {
|
||||
MAIN_LOGO => $self->conf->{portalMainLogo},
|
||||
LANGS => $self->conf->{showLanguages},
|
||||
FORMACTION => $form_action,
|
||||
PORTALBUTTON => 1,
|
||||
MSG => $message,
|
||||
BUTTON => $buttonlabel,
|
||||
CONFIRMKEY => $self->p->stamp,
|
||||
PORTAL => $self->conf->{portal},
|
||||
FORCEUPGRADE => $forceUpgrade,
|
||||
URL => $url,
|
||||
(
|
||||
|
|
Loading…
Reference in New Issue