Skip to content

Commit

Permalink
cs
Browse files Browse the repository at this point in the history
  • Loading branch information
Guite committed Apr 2, 2023
1 parent 4145eae commit 70c44e4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/system/LegalBundle/Controller/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@

use Doctrine\Persistence\ManagerRegistry;
use EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator;
use Nucleos\UserBundle\Security\LoginManager;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\DependencyInjection\Attribute\Autowire;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
Expand All @@ -28,16 +30,21 @@
use Zikula\ThemeBundle\Controller\Dashboard\UserDashboardController;
use Zikula\UsersBundle\Api\ApiInterface\CurrentUserApiInterface;
use Zikula\UsersBundle\Entity\User;
use Zikula\UsersBundle\Helper\AccessHelper;
use Zikula\UsersBundle\Repository\UserRepositoryInterface;

#[Route('/legal')]
class UserController extends AbstractController
{
private string $firewallName;

public function __construct(
private readonly SiteDefinitionInterface $site,
private readonly array $legalConfig
private readonly array $legalConfig,
private readonly LoginManager $loginManager,
#[Autowire(service: 'nucleos_user.firewall_name')]
string $firewallName
) {
$this->firewallName = $firewallName;
}

/**
Expand Down Expand Up @@ -155,7 +162,6 @@ public function acceptPolicies(
ManagerRegistry $doctrine,
CurrentUserApiInterface $currentUserApi,
UserRepositoryInterface $userRepository,
AccessHelper $accessHelper,
AcceptPoliciesHelper $acceptPoliciesHelper
): Response {
// Retrieve and delete any session variables being sent in by the log-in process before we give the function a chance to
Expand Down Expand Up @@ -200,7 +206,7 @@ public function acceptPolicies(
}
$doctrine->getManager()->flush();
if ($data['acceptedpolicies_policies'] && $data['login']) {
$accessHelper->login($userEntity);
$this->loginManager->logInUser($this->firewallName, $userEntity);
}

return $this->redirectToRoute('home');
Expand Down
1 change: 1 addition & 0 deletions src/system/UsersBundle/Entity/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
use Nucleos\UserBundle\Validator\Constraints\Pattern as PasswordPattern;
use Symfony\Component\Validator\Constraints as Assert;
use Zikula\CoreBundle\Doctrine\DBAL\CustomTypes;
use Zikula\UsersBundle\UsersConstant;

// #[ORM\Entity(repositoryClass: UserRepository::class)] TODO remove if unneeded
#[ORM\Entity]
Expand Down

0 comments on commit 70c44e4

Please sign in to comment.