Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions module/VuFind/src/VuFind/Captcha/Interval.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,9 @@

use Laminas\Mvc\Controller\Plugin\Params;
use Laminas\Session\Container as SessionContainer;
use VuFind\Config\Config;
use VuFind\I18n\Translator\TranslatorAwareInterface;
use VuFind\I18n\Translator\TranslatorAwareTrait;

use function intval;

/**
* Interval CAPTCHA (requires an interval between actions or from start of session).
*
Expand Down Expand Up @@ -82,14 +79,14 @@ class Interval extends AbstractBase implements TranslatorAwareInterface
* Constructor.
*
* @param SessionContainer $sc Session data container
* @param Config $config VuFind main configuration
* @param array $config VuFind main configuration
*/
public function __construct(SessionContainer $sc, Config $config)
public function __construct(SessionContainer $sc, array $config)
{
$this->sessionData = $sc;
$this->actionInterval = intval($config->Captcha->action_interval ?? 60);
$this->timeFromSessionStart = intval(
$config->Captcha->time_from_session_start ?? $this->actionInterval
$this->actionInterval = (int)($config['Captcha']['action_interval'] ?? 60);
$this->timeFromSessionStart = (int)(
$config['Captcha']['time_from_session_start'] ?? $this->actionInterval
);
}

Expand Down
2 changes: 1 addition & 1 deletion module/VuFind/src/VuFind/Captcha/IntervalFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function __invoke(
);
return new $requestedName(
$sessionStorage,
$container->get(\VuFind\Config\ConfigManagerInterface::class)->getConfigObject('config')
$container->get(\VuFind\Config\ConfigManagerInterface::class)->getConfigArray('config')
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,11 @@ class IntervalTest extends \PHPUnit\Framework\TestCase
public function testIntervalCaptcha(): void
{
$session = new \Laminas\Session\Container('SessionState');
$config = new \VuFind\Config\Config(
[
'Captcha' => [
'time_from_session_start' => 20,
],
]
);
$config = [
'Captcha' => [
'time_from_session_start' => 20,
],
];

$interval = new \VuFind\Captcha\Interval($session, $config);

Expand Down