[TYPO3-dev] Create and login temp user
Sebastian Gebhard
s.gebhard at markenmotiv.de
Thu Mar 12 15:06:01 CET 2009
Peter Russ schrieb:
> Just check the auth service: that's the rightway to do -> tx_sv_auth
Maybe this is not the best solution but it works:
function forceLogin(){
if(!$GLOBALS['TSFE']->fe_user->user){
$time = time();
$user = array(
'pid' => $this->conf['feUserPid'],
'tstamp' => $time,
'crdate' => $time,
'username' => $this->fl_username(),
'password' => $this->fl_password(),
'usergroup' => $this->conf['feTmpUserGroupId']
);
$GLOBALS['TYPO3_DB']->exec_INSERTquery('fe_users', $user);
$params = array(
'logintype' => 'login',
'pid' => $this->conf['feUserPid'],
'user' => $user['username'],
'pass' => $user['password'],
$this->prefixId.'[redirect_url]' =>
$this->pi_getPageLink($GLOBALS['TSFE']->id)
);
$url = $this->pi_getPageLink($GLOBALS['TSFE']->id, '', $params);
header('Location: '.t3lib_div::locationHeaderUrl($url));
}
}
and in the main() of my extension:
$returnUrl = $this->piVars['returnUrl'];
if($returnUrl){
header('Location: '.t3lib_div::locationHeaderUrl($returnUrl));
}
So there are two redirect, the first for login and the second to remove
username and password from the get params.
More information about the TYPO3-dev
mailing list