[TYPO3-english] automatic fe-user login - restricted elements not shown until reload

Stefan Franke stefan.franke at gmx.co.uk
Tue Sep 11 17:18:51 CEST 2012


Hello,
I'm trying to find a hook to log in an frontend user when I call a page with the GET-parameters "user" and "pass".

That's the code I'm using inside the hook:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if ($_GET['user'] && $_GET['pass']) {
    $loginData = array(
		'uname' => trim($_GET['user']),
		'uident'=> trim($_GET['pass']),
		'status' =>'login'
	);
	
	$GLOBALS['TSFE']->fe_user->checkPid = 0;
	$info = $GLOBALS['TSFE']->fe_user->getAuthInfoArray();
	$user = $GLOBALS['TSFE']->fe_user->fetchUserRecord($info['db_user'], $loginData['uname']);
	$ok = $GLOBALS['TSFE']->fe_user->compareUident($user, $loginData);
	
	if ($ok) {
		$GLOBALS['TSFE']->fe_user->createUserSession($user);
	}
}
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

The code is working fine, albeit the restricted elements on the page are not shown until I reload the page.

Is there a way to use a hook to log in the user AND show the restricted elements without having to reload the page?

Thanks for your help!

Best,
Stefan




More information about the TYPO3-english mailing list