Adds a setting to disable first time wizard for new users (#5938)

This commit is contained in:
Tobias Perschon
2026-05-23 18:48:42 +02:00
committed by GitHub
parent eeeeae41e7
commit 8d245ae223
10 changed files with 146 additions and 6 deletions

View File

@@ -9,6 +9,7 @@
namespace App\EventSubscriber;
use App\Configuration\SystemConfiguration;
use App\Entity\User;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
@@ -23,7 +24,8 @@ class WizardSubscriber implements EventSubscriberInterface
public function __construct(
private UrlGeneratorInterface $urlGenerator,
private AuthorizationCheckerInterface $security,
private TokenStorageInterface $storage
private TokenStorageInterface $storage,
private SystemConfiguration $systemConfiguration
) {
}
@@ -63,6 +65,15 @@ class WizardSubscriber implements EventSubscriberInterface
return;
}
if ($user->requiresPasswordReset()) {
$response = new RedirectResponse($this->urlGenerator->generate('wizard', ['wizard' => 'password']));
$event->setResponse($response);
}
if ($user->isRegularUserOnly() && !$this->systemConfiguration->isUserWizardActive()) {
return;
}
foreach (User::WIZARDS as $wizard) {
if (!$user->hasSeenWizard($wizard)) {
$response = new RedirectResponse($this->urlGenerator->generate('wizard', ['wizard' => $wizard]));
@@ -71,10 +82,5 @@ class WizardSubscriber implements EventSubscriberInterface
return;
}
}
if ($user->requiresPasswordReset()) {
$response = new RedirectResponse($this->urlGenerator->generate('wizard', ['wizard' => 'password']));
$event->setResponse($response);
}
}
}