126 parent::__construct();
130 $this->dontSetCookie = TRUE;
132 $this->session_table =
'fe_sessions';
133 $this->name = self::getCookieName();
134 $this->get_name =
'ftu';
135 $this->loginType =
'FE';
136 $this->user_table =
'fe_users';
137 $this->username_column =
'username';
138 $this->userident_column =
'password';
139 $this->userid_column =
'uid';
140 $this->lastLogin_column =
'lastlogin';
141 $this->enablecolumns = array(
142 'deleted' =>
'deleted',
143 'disabled' =>
'disable',
144 'starttime' =>
'starttime',
145 'endtime' =>
'endtime' 147 $this->formfield_uname =
'user';
148 $this->formfield_uident =
'pass';
149 $this->formfield_chalvalue =
'challenge';
150 $this->formfield_status =
'logintype';
151 $this->auth_timeout_field = 6000;
152 $this->sendNoCacheHeaders = FALSE;
153 $this->getFallBack = TRUE;
154 $this->getMethodEnabled = TRUE;
178 if ((
int)$this->auth_timeout_field > 0 && (
int)$this->auth_timeout_field < $this->lifetime) {
182 $this->sessionDataLifetime = (int)
$GLOBALS[
'TYPO3_CONF_VARS'][
'FE'][
'sessionDataLifetime'];
183 if ($this->sessionDataLifetime <= 0) {
184 $this->sessionDataLifetime = 86400;
197 $insertFields = parent::getNewSessionRecord($tempuser);
199 return $insertFields;
210 return ($this->newSessionID || $this->forceSetCookie)
211 && ($this->lifetime == 0 || !isset($this->user[
'ses_permanent']) || !$this->user[
'ses_permanent']);
222 return $this->lifetime > 0 && isset($this->user[
'ses_permanent']) && $this->user[
'ses_permanent'];
233 $loginData = parent::getLoginFormData();
234 if (
$GLOBALS[
'TYPO3_CONF_VARS'][
'FE'][
'permalogin'] == 0 ||
$GLOBALS[
'TYPO3_CONF_VARS'][
'FE'][
'permalogin'] == 1) {
235 if ($this->getMethodEnabled) {
240 if (strlen($isPermanent) != 1) {
241 $isPermanent =
$GLOBALS[
'TYPO3_CONF_VARS'][
'FE'][
'permalogin'];
242 } elseif (!$isPermanent) {
245 $this->forceSetCookie = TRUE;
247 $isPermanent = $isPermanent ? 1 : 0;
248 } elseif (
$GLOBALS[
'TYPO3_CONF_VARS'][
'FE'][
'permalogin'] == 2) {
253 $loginData[
'permanent'] = $isPermanent;
254 $this->is_permanent = $isPermanent;
270 $this->dontSetCookie = FALSE;
271 return parent::createUserSession($tempuser);
283 $this->TSdataArray = array();
284 $this->userTS = array();
285 $this->userTSUpdated = FALSE;
286 $this->groupData = array(
292 $this->TSdataArray[] =
$GLOBALS[
'TYPO3_CONF_VARS'][
'FE'][
'defaultUserTSconfig'];
295 if ($this->writeDevLog) {
296 if (is_array($this->user)) {
299 GeneralUtility::devLog(
'Get usergroups for "anonymous" user',
'TYPO3\\CMS\\Frontend\\Authentication\\FrontendUserAuthentication');
302 $groupDataArr = array();
307 $serviceChain .=
',' . $serviceObj->getServiceKey();
308 $serviceObj->initAuth($subType, array(), $authInfo, $this);
309 $groupData = $serviceObj->getGroups($this->user, $groupDataArr);
316 if ($this->writeDevLog && $serviceChain) {
317 GeneralUtility::devLog($subType .
' auth services called: ' . $serviceChain,
'TYPO3\\CMS\\Frontend\\Authentication\\FrontendUserAuthentication');
319 if ($this->writeDevLog && !count($groupDataArr)) {
320 GeneralUtility::devLog(
'No usergroups found by services',
'TYPO3\\CMS\\Frontend\\Authentication\\FrontendUserAuthentication');
322 if ($this->writeDevLog && count($groupDataArr)) {
323 GeneralUtility::devLog(count($groupDataArr) .
' usergroup records found by services',
'TYPO3\\CMS\\Frontend\\Authentication\\FrontendUserAuthentication');
332 $serviceChain .=
',' . $serviceObj->getServiceKey();
333 $serviceObj->initAuth($subType, array(), $authInfo, $this);
334 if (!$serviceObj->authGroup($this->user, $groupData)) {
336 if ($this->writeDevLog) {
344 if ($validGroup && (
string)$groupData[
'uid'] !==
'') {
345 $this->groupData[
'title'][$groupData[
'uid']] = $groupData[
'title'];
346 $this->groupData[
'uid'][$groupData[
'uid']] = $groupData[
'uid'];
347 $this->groupData[
'pid'][$groupData[
'uid']] = $groupData[
'pid'];
348 $this->groupData[
'TSconfig'][$groupData[
'uid']] = $groupData[
'TSconfig'];
351 if (count($this->groupData) && count($this->groupData[
'TSconfig'])) {
353 foreach ($this->groupData[
'TSconfig'] as $TSdata) {
354 $this->TSdataArray[] = $TSdata;
356 $this->TSdataArray[] = $this->user[
'TSconfig'];
358 ksort($this->groupData[
'title']);
359 ksort($this->groupData[
'uid']);
360 ksort($this->groupData[
'pid']);
362 return count($this->groupData[
'uid']) ?: 0;
373 if (!$this->userTSUpdated) {
376 $userTS = implode(LF .
'[GLOBAL]' . LF, $this->TSdataArray);
379 $this->userTS = $parseObj->setup;
380 $this->userTSUpdated = TRUE;
402 if ($this->
id && !count($this->sesData)) {
403 $statement = $this->db->prepare_SELECTquery(
'*',
'fe_session_data',
'hash = :hash');
404 $statement->execute(array(
':hash' => $this->
id));
405 if (($sesDataRow = $statement->fetch()) !== FALSE) {
406 $this->sesData = unserialize($sesDataRow[
'content']);
407 $this->sessionDataTimestamp = $sesDataRow[
'tstamp'];
425 if ($this->userData_change) {
428 if ($this->sesData_change && $this->
id) {
429 if (empty($this->sesData)) {
433 if (empty($this->user[
'uid']) && !$this->loginHidden && $this->
isCookieSet()) {
436 } elseif ($this->sessionDataTimestamp === NULL) {
438 $insertFields = array(
440 'content' => serialize($this->sesData),
443 $this->sessionDataTimestamp =
$GLOBALS[
'EXEC_TIME'];
444 $this->db->exec_INSERTquery(
'fe_session_data', $insertFields);
449 $updateFields = array(
450 'content' => serialize($this->sesData),
453 $this->sessionDataTimestamp =
$GLOBALS[
'EXEC_TIME'];
454 $this->db->exec_UPDATEquery(
'fe_session_data',
'hash=' . $this->db->fullQuoteStr($this->id,
'fe_session_data'), $updateFields);
465 $this->sessionDataTimestamp = NULL;
466 $this->db->exec_DELETEquery(
'fe_session_data',
'hash=' . $this->db->fullQuoteStr($this->id,
'fe_session_data'));
491 parent::regenerateSessionId();
493 $this->db->exec_UPDATEquery(
495 'hash=' . $this->db->fullQuoteStr($oldSessionId,
'fe_session_data'),
496 array(
'hash' => $this->
id)
499 $this->dontSetCookie = FALSE;
508 public function gc() {
509 $timeoutTimeStamp = (int)(
$GLOBALS[
'EXEC_TIME'] - $this->sessionDataLifetime);
510 $this->db->exec_DELETEquery(
'fe_session_data',
'tstamp < ' . $timeoutTimeStamp);
531 $value = $this->uc[$key];
534 $value = $this->sesData[$key];
553 public function setKey($type, $key, $data) {
559 if ($this->user[
'uid']) {
560 if ($data === NULL) {
561 unset($this->uc[$key]);
563 $this->uc[$key] = $data;
565 $this->userData_change = TRUE;
569 if ($data === NULL) {
570 unset($this->sesData[$key]);
572 $this->sesData[$key] = $data;
574 $this->sesData_change = TRUE;
587 return $this->
getKey(
'ses', $key);
598 $this->
setKey(
'ses', $key, $data);
616 if (!$maxSizeOfSessionData || $this->
isCookieSet()) {
617 if ($recs[
'clear_all']) {
618 $this->
setKey(
'ses',
'recs', array());
621 $recs_array = $this->
getKey(
'ses',
'recs');
622 foreach ($recs as $table => $data) {
623 if (is_array($data)) {
624 foreach ($data as $rec_id => $value) {
625 if ($value != $recs_array[$table][$rec_id]) {
626 $recs_array[$table][$rec_id] = $value;
632 if ($change && (!$maxSizeOfSessionData || strlen(serialize($recs_array)) < $maxSizeOfSessionData)) {
633 $this->
setKey(
'ses',
'recs', $recs_array);
650 $count = parent::isExistingSessionRecord(
$id);
652 if ($count == FALSE) {
653 $statement = $this->db->prepare_SELECTquery(
'content,tstamp',
'fe_session_data',
'hash = :hash');
654 $res = $statement->execute(array(
':hash' =>
$id));
655 if ($res !== FALSE) {
656 if ($sesDataRow = $statement->fetch()) {
658 $this->sesData = unserialize($sesDataRow[
'content']);
659 $this->sessionDataTimestamp = $sesDataRow[
'tstamp'];
677 $this->loginHidden = TRUE;
isRefreshTimeBasedCookie()
static devLog($msg, $extKey, $severity=0, $dataVar=FALSE)
static arrayToLogString(array $arr, $valueList=array(), $valueLength=20)
record_registration($recs, $maxSizeOfSessionData=0)
static makeInstanceService($serviceType, $serviceSubType='', $excludeServiceKeys=array())
static makeInstance($className)
removeCookie($cookieName)
setKey($type, $key, $data)
static checkIncludeLines_array(array $array)
isExistingSessionRecord($id)
createUserSession($tempuser)
static array_merge(array $arr1, array $arr2)
getNewSessionRecord($tempuser)
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]
setAndSaveSessionData($key, $data)