mirror of
https://github.com/wallabag/wallabag.git
synced 2025-01-18 04:45:27 +00:00
Use one expression language instance for all extra fields
This commit is contained in:
parent
1e1d58da7f
commit
01f42d52ef
1 changed files with 3 additions and 15 deletions
|
@ -10,11 +10,11 @@ use Wallabag\ExpressionLanguage\AuthenticatorProvider;
|
|||
|
||||
class LoginFormAuthenticator
|
||||
{
|
||||
private AuthenticatorProvider $authenticatorProvider;
|
||||
private ExpressionLanguage $expressionLanguage;
|
||||
|
||||
public function __construct(AuthenticatorProvider $authenticatorProvider)
|
||||
{
|
||||
$this->authenticatorProvider = $authenticatorProvider;
|
||||
$this->expressionLanguage = new ExpressionLanguage(null, [$authenticatorProvider]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -90,8 +90,7 @@ class LoginFormAuthenticator
|
|||
|
||||
foreach ($siteConfig->getExtraFields() as $fieldName => $fieldValue) {
|
||||
if ('@=' === substr($fieldValue, 0, 2)) {
|
||||
$expressionLanguage = $this->getExpressionLanguage();
|
||||
$fieldValue = $expressionLanguage->evaluate(
|
||||
$fieldValue = $this->expressionLanguage->evaluate(
|
||||
substr($fieldValue, 2),
|
||||
[
|
||||
'config' => $siteConfig,
|
||||
|
@ -104,15 +103,4 @@ class LoginFormAuthenticator
|
|||
|
||||
return $extraFields;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ExpressionLanguage
|
||||
*/
|
||||
private function getExpressionLanguage()
|
||||
{
|
||||
return new ExpressionLanguage(
|
||||
null,
|
||||
[$this->authenticatorProvider]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue