Typo3 Extbase losing fe_user authentication

给你一囗甜甜゛ 提交于 2019-12-12 02:07:31

问题


I have this little snippet for logging in a user with my own Typo3 extension:

$GLOBALS['TSFE']->fe_user->createUserSession(array());
$GLOBALS['TSFE']->fe_user->user = $GLOBALS['TSFE']->fe_user->getRawUserByUid($this->userRepository->findByUsername($winAcc)->toArray()[0]->getUid());
$GLOBALS['TSFE']->fe_user->fetchGroupData();
$GLOBALS['TSFE']->loginUser = 1;

In the fluid template I can check if a user is logged in with this:

<f:security.ifAuthenticated>
  This is being shown whenever a FE user is logged in
</f:security.ifAuthenticated>

However this code works only for the next action which is executed in the controller. When the FrontEnd User reloads the page, the authentication is lost and also $GLOBALS["TSFE"]->loginUser is null.

Why is this happening?


回答1:


Okey, I have the solution for this problem. In Typo3 6.2 LTS there seems to be a different cookie handling. The cookie fe_user cookie is not being set. Use any method of TSFE to force typo3 to set this cookie.



来源:https://stackoverflow.com/questions/26398653/typo3-extbase-losing-fe-user-authentication

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!