This commit is contained in:
Andreas Schempp committed 2025-04-10 09:01:50 +02:00
1 parent ce9686079f
commit a347e3d722
3 files changed
+4 -9

No files matched your search

-1
View File
@@ -24,7 +24,6 @@ services:
Terminal42\PasswordValidationBundle\EventListener\RedirectToPasswordChangePageListener:
arguments:
- '@contao.framework'
- '@security.token_storage'
- '@contao.routing.scope_matcher'
tags:
@@ -6,7 +6,6 @@ namespace Terminal42\PasswordValidationBundle\EventListener;
use Contao\CoreBundle\Exception\PageNotFoundException;
use Contao\CoreBundle\Exception\RedirectResponseException;
use Contao\CoreBundle\Framework\ContaoFramework;
use Contao\CoreBundle\Routing\ScopeMatcher;
use Contao\FrontendUser;
use Contao\PageModel;
@@ -16,7 +15,6 @@ use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInt
final readonly class RedirectToPasswordChangePageListener
{
public function __construct(
private ContaoFramework $framework,
private TokenStorageInterface $tokenStorage,
private ScopeMatcher $scopeMatcher,
) {
@@ -36,12 +34,10 @@ final readonly class RedirectToPasswordChangePageListener
return;
}
/** @var PageModel $adapter */
$adapter = $this->framework->getAdapter(PageModel::class);
$rootPage = $adapter->findById($page->rootId);
$rootPage = PageModel::findById($page->rootId);
// Search for password-change page
$pwChangePage = $adapter->findPublishedById($rootPage->pwChangePage ?? 0);
$pwChangePage = PageModel::findPublishedById($rootPage->pwChangePage ?? 0);
if (!$pwChangePage instanceof PageModel) {
throw new PageNotFoundException('No password-change page found.');
+2 -2
View File
@@ -20,7 +20,7 @@ final class ValidationConfiguration
/**
* @var array<string, array<string, mixed>> Configuration parameters in the format [Contao\FrontendUser => [ min_chars => 8, max_chars => 20 ]]
*/
private $configurations = [];
private array $configurations = [];
public function addConfiguration(string $entityName, array $configuration): void
{
@@ -34,6 +34,6 @@ final class ValidationConfiguration
public function getConfiguration(string $entityName): array|null
{
return $this->configurations[$entityName];
return $this->configurations[$entityName] ?? null;
}
}