script

Wednesday, March 13, 2013

create automatic login in typo3

$UserData = $GLOBALS["TYPO3_DB"]->exec_SELECTgetrows('uid,username,password','fe_users','username="'.$user_profile['email'].'"');
           
 $loginData = array('uname' => $UserData[0]['username'], 'uident'=> $UserData[0]['password'] ,'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']);
                    $login_success = $GLOBALS['TSFE']->fe_user->compareUident($user,$loginData);
 if($login_success){
$GLOBALS['TSFE']->fe_user->createUserSession($user);
header("Location:".$this->getURL($GLOBALS["TSFE"]->id));
exit;
}

No comments:

Post a Comment