eZ trouble shooting: Login into the new stack from the legacy stack
eZ Systems changed the way how logins are handled a few versions ago (versions > 5.3).
If your application still uses the legacy stack and you are using your own login module in the old stack you might have a problem: the new eZ (and Symfony) version will not login the user on the Symfony stack.
If you want to login a user in the new stack as well as in the legacy stack this solution in eZ 4 might help:
$userId = = 1224; $container = ezpKernel::instance()->getServiceContainer(); try { $repository = $container->get('ezpublish.api.repository'); $userService = $repository->getUserService(); $ezUser = $userService->loadUser($userId); if ($ezUser) { $user = new CoreUser($ezUser); $providerKey = 'ezpublish_front'; $token = new UsernamePasswordToken($user, null, $providerKey); $securityContextService = $container->get('security.context'); $securityContextService->setToken($token); $repository->setCurrentUser($ezUser); } else { eZDebug::writeError('User with id '.$userId.' in new stack not found, login falied',__METHOD__); } } catch (\Exception $e) { eZDebug::writeError("Exception while trying to login on new stack: ". $e->getMessage()); }https://blog.silversolutions.de/2015/08/b2b-technologie/login-stack-legacy-stack/https://blog.silversolutions.de/wp-content/uploads/2018/12/ez_dummy.pnghttps://blog.silversolutions.de/wp-content/uploads/2018/12/ez_dummy-150x150.pngB2B.technologiePraxis,Symfony,Tipps & TrickseZ Systems changed the way how logins are handled a few versions ago (versions > 5.3). If your application still uses the legacy stack and you are using your own login module in the old stack you might have a problem: the new eZ (and Symfony) version will not login the user...Frank DegeFrank Degefd@silversolutions.deAdministratorFrank Dege ist seit mittlerweile fast 30 Jahren online (irgendwann hieß das ja mal BTX) und beschäftigt sich schon fast genauso lange mit dem Thema elektronischer Handel. Bereits im Rahmen seiner Diplomarbeit an der TU Berlin hat er mit einem kleinen Team einen eigenen Online-Shop entwickelt und automatische Test-Verfahren für Online-Anwendungen entworfen. Für silver.solutions verantwortet Frank Dege federführend die Architektur und Produktstrategie der Onlineshop-Software silver.eShop. Wenn Frank nicht programmiert, dann tischlert er.silver.solutions