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

Björn Pedersen pedersen at frm2.tum.de
Tue Sep 11 17:41:31 CEST 2012


Am 11.09.2012 17:18, schrieb Stefan Franke:
> 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);
> 	}
> }

Hi,

you should probably just pass the parameters  (uname, uident, status,
chalvalue(for non-plain passwords))in the correct fields directly, for
FE login get params are enabled by default.

Björn






More information about the TYPO3-english mailing list