[TYPO3-dev] Do a FE_Login in Typo3 6.2 Extension

Benedikt Wiesnet benedikt at wiesnet.de
Thu Oct 16 14:32:41 CEST 2014


Hi everybody,

I have read a lot about how to login a fe_user from php. My Snippet for doing this is:

$GLOBALS['TSFE']->fe_user->start();
$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;
$GLOBALS["TSFE"]->fe_user->storeSessionData();

And in the view I check if a user is logged in via: <f:security.ifAuthenticated>

However, I am able to do a login but after being redirected or navigating to another page, the <f:security.ifAuthenticated> is no longer working (the user is not logged in anymore). Why is this happening?





More information about the TYPO3-dev mailing list