Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Xavier Bachelot
lemonldap-ng
Commits
059d5320
Commit
059d5320
authored
Jan 31, 2019
by
Clément OUDOT
Browse files
Clean code that manages templates parameters (#1634, #1631)
parent
d7c252d5
Changes
4
Show whitespace changes
Inline
Side-by-side
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Display.pm
View file @
059d5320
...
...
@@ -418,18 +418,6 @@ sub display {
}
# Additional $req param
%templateParams
=
(
%templateParams
,
%
{
$req
->
{
customParameters
}
//
{}
},
);
for
my
$session_key
(
keys
%
{
$req
->
{
sessionInfo
}
}
)
{
$templateParams
{
"
session_
"
.
$session_key
}
=
$req
->
{
sessionInfo
}
->
{
$session_key
};
}
for
my
$env_key
(
keys
%
{
$req
->
env
}
)
{
$templateParams
{
"
env_
"
.
$env_key
}
=
$req
->
env
->
{
$env_key
};
}
$self
->
logger
->
debug
("
Skin returned:
$skinfile
");
return
(
$skinfile
,
\
%templateParams
);
}
...
...
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Run.pm
View file @
059d5320
...
...
@@ -843,16 +843,30 @@ sub rebuildCookies {
}
sub
tplParams
{
my
$portalPath
=
$_
[
0
]
->
conf
->
{
portal
};
my
(
$self
,
$req
)
=
@_
;
my
%templateParams
;
my
$portalPath
=
$self
->
conf
->
{
portal
};
$portalPath
=~
s#^https?://[^/]+/?#/#
;
$portalPath
=~
s#[^/]+\.fcgi$##
;
for
my
$session_key
(
keys
%
{
$req
->
{
sessionInfo
}
}
)
{
$templateParams
{
"
session_
"
.
$session_key
}
=
$req
->
{
sessionInfo
}
->
{
$session_key
};
}
for
my
$env_key
(
keys
%
{
$req
->
env
}
)
{
$templateParams
{
"
env_
"
.
$env_key
}
=
$req
->
env
->
{
$env_key
};
}
return
(
SKIN
=>
$
_
[
0
]
->
getSkin
(
$
_
[
1
]
),
PORTAL_URL
=>
$
_
[
0
]
->
conf
->
{
portal
},
SKIN
=>
$
self
->
getSkin
(
$
req
),
PORTAL_URL
=>
$
self
->
conf
->
{
portal
},
SKIN_PATH
=>
$portalPath
.
"
skins
",
ANTIFRAME
=>
$_
[
0
]
->
conf
->
{
portalAntiFrame
},
SKIN_BG
=>
$_
[
0
]
->
conf
->
{
portalSkinBackground
},
(
$_
[
0
]
->
customParameters
?
(
%
{
$_
[
0
]
->
customParameters
}
)
:
()
),
ANTIFRAME
=>
$self
->
conf
->
{
portalAntiFrame
},
SKIN_BG
=>
$self
->
conf
->
{
portalSkinBackground
},
(
$self
->
customParameters
?
(
%
{
$self
->
customParameters
}
)
:
()
),
%templateParams
);
}
...
...
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/MailPasswordReset.pm
View file @
059d5320
...
...
@@ -594,17 +594,6 @@ sub display {
$tplPrm
{
DISPLAY_PASSWORD_FORM
}
=
$req
->
sessionInfo
->
{
pwdAllowed
};
}
# Custom template parameters
if
(
my
$customParams
=
$self
->
p
->
customParameters
)
{
foreach
(
keys
%$customParams
)
{
$tplPrm
{
$_
}
=
$customParams
->
{
$_
};
}
}
for
my
$env_key
(
keys
%
{
$req
->
env
}
)
{
$tplPrm
{
"
env_
"
.
$env_key
}
=
$req
->
env
->
{
$env_key
};
}
return
'
mail
',
\
%tplPrm
;
}
...
...
lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/Register.pm
View file @
059d5320
...
...
@@ -522,10 +522,6 @@ sub display {
);
}
for
my
$env_key
(
keys
%
{
$req
->
env
}
)
{
$templateParams
{
"
env_
"
.
$env_key
}
=
$req
->
env
->
{
$env_key
};
}
return
(
'
register
',
\
%templateParams
);
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment