Index: typo3/sysext/felogin/ext_emconf.php =================================================================== --- typo3/sysext/felogin/ext_emconf.php (revision 4595) +++ typo3/sysext/felogin/ext_emconf.php (working copy) @@ -29,7 +29,7 @@ 'clearCacheOnLoad' => 1, 'lockType' => '', 'author_company' => '', - 'version' => '1.0.0', + 'version' => '1.2.0', 'constraints' => array( 'depends' => array( 'php' => '5.1.0-0.0.0', Index: typo3/sysext/felogin/ext_tables.php =================================================================== --- typo3/sysext/felogin/ext_tables.php (revision 4595) +++ typo3/sysext/felogin/ext_tables.php (working copy) @@ -17,19 +17,27 @@ --div--;LLL:EXT:cms/locallang_tca.xml:pages.tabs.access,,starttime, endtime'; // Adds the redirect-field to the fe_group- and fe_users-table -$tempColumns = Array ( - "felogin_redirectPid" => Array ( - "exclude" => 1, - "label" => "LLL:EXT:felogin/locallang_db.xml:felogin_redirectPid", - "config" => Array ( - "type" => "group", - "internal_type" => "db", - "allowed" => "pages", - "size" => 1, - "minitems" => 0, - "maxitems" => 1, +$tempColumns = array ( + 'felogin_redirectPid' => array ( + 'exclude' => 1, + 'label' => 'LLL:EXT:felogin/locallang_db.xml:felogin_redirectPid', + 'config' => array ( + 'type' => 'group', + 'internal_type' => 'db', + 'allowed' => 'pages', + 'size' => 1, + 'minitems' => 0, + 'maxitems' => 1, ) ), + 'felogin_forgotHash' => array ( + 'exclude' => 1, + 'label' => 'LLL:EXT:felogin/locallang_db.xml:felogin_forgotHash', + 'config' => array ( + 'type' => 'passthrough', + + ) + ), ); t3lib_div::loadTCA("fe_groups"); Index: typo3/sysext/felogin/ext_tables.sql =================================================================== --- typo3/sysext/felogin/ext_tables.sql (revision 4595) +++ typo3/sysext/felogin/ext_tables.sql (working copy) @@ -1,17 +1,18 @@ -# -# Table structure for table 'fe_groups' -# -CREATE TABLE fe_groups ( - felogin_redirectPid tinytext -); - - - -# -# Table structure for table 'fe_users' -# -CREATE TABLE fe_users ( - felogin_redirectPid tinytext -); - - +# +# Table structure for table 'fe_groups' +# +CREATE TABLE fe_groups ( + felogin_redirectPid tinytext +); + + + +# +# Table structure for table 'fe_users' +# +CREATE TABLE fe_users ( + felogin_redirectPid tinytext + felogin_forgotHash varchar(80) default '' +); + + Index: typo3/sysext/felogin/ext_typoscript_setup.txt =================================================================== --- typo3/sysext/felogin/ext_typoscript_setup.txt (revision 4595) +++ typo3/sysext/felogin/ext_typoscript_setup.txt (working copy) @@ -5,6 +5,9 @@ #Template File templateFile = EXT:felogin/template.html + #baseURL for the link generation + feloginBaseURL = + #wrapContentInBaseClass wrapContentInBaseClass = 1 @@ -22,8 +25,12 @@ #additional fields showForgotPasswordLink = showPermaLogin = + + # time in hours how long the sended link for forget password is valid + forgotLinkHashValidTime = 12 - + newPasswordMinLength = 6 + welcomeHeader_stdWrap { wrap =

|

} @@ -59,8 +66,15 @@ wrap =
|
} + changePasswordHeader_stdWrap { + wrap =

|

+ } + changePasswordMessage_stdWrap { + wrap =
|
+ } + #redirect redirectMode = redirectFirstMethod = Index: typo3/sysext/felogin/locallang_db.xml =================================================================== --- typo3/sysext/felogin/locallang_db.xml (revision 4595) +++ typo3/sysext/felogin/locallang_db.xml (working copy) @@ -8,6 +8,7 @@ + Index: typo3/sysext/felogin/pi1/class.tx_felogin_pi1.php =================================================================== --- typo3/sysext/felogin/pi1/class.tx_felogin_pi1.php (revision 4595) +++ typo3/sysext/felogin/pi1/class.tx_felogin_pi1.php (working copy) @@ -73,7 +73,11 @@ // Get storage PIDs: if ($this->conf['storagePid']) { - $this->spid = $this->conf['storagePid']; + if (intval($this->conf['recursive'])) { + $this->spid = $this->pi_getPidList($this->conf['storagePid'], intval($this->conf['recursive'])); + } else { + $this->spid = $this->conf['storagePid']; + } } else { $pids = $GLOBALS['TSFE']->getStorageSiterootPids(); $this->spid = $pids['_STORAGE_PID']; @@ -83,8 +87,7 @@ $this->logintype = t3lib_div::_GP('logintype'); $this->redirectUrl = t3lib_div::_GP('redirect_url'); - - + // Get Template $templateFile = $this->conf['templateFile'] ? $this->conf['templateFile'] : 'EXT:felogin/template.html'; $this->template = $this->cObj->fileResource($templateFile); @@ -97,11 +100,12 @@ $this->redirectUrl = $this->processRedirect(); } - // What to display $content=''; if ($this->piVars['forgot']) { $content .= $this->showForgot(); + } elseif ($this->piVars['forgothash']) { + $content .= $this->changePassword(); } else { if($this->userIsLoggedIn && !$this->logintype) { $content .= $this->showLogout(); @@ -133,47 +137,54 @@ protected function showForgot() { $subpart = $this->cObj->getSubpart($this->template, '###TEMPLATE_FORGOT###'); $subpartArray = $linkpartArray = array(); + $postData = t3lib_div::_POST($this->prefixId); + + if ($postData['forgot_email']) { - if ($this->piVars['forgot_email']) { - if (t3lib_div::validEmail($this->piVars['forgot_email'])) { - // look for user record and send the password + // get hashes for compare + $postedHash = $postData['forgot_hash']; + $hashData = $GLOBALS["TSFE"]->fe_user->getKey('ses', 'forgot_hash'); + + + if ($postedHash === $hashData['forgot_hash']) { + $row = FALSE; + + // look for user record + $data = $GLOBALS['TYPO3_DB']->fullQuoteStr($this->piVars['forgot_email'], 'fe_users'); $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery( - 'uid, username, password', + 'uid, username, password, email', 'fe_users', - 'email='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->piVars['forgot_email'], 'fe_users').' AND pid IN ('.$GLOBALS['TYPO3_DB']->cleanIntList($this->spid).') '.$this->cObj->enableFields('fe_users') + '(email=' . $data .' OR username=' . $data . ') AND pid IN ('.$GLOBALS['TYPO3_DB']->cleanIntList($this->spid).') '.$this->cObj->enableFields('fe_users') ); if ($GLOBALS['TYPO3_DB']->sql_num_rows($res)) { $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res); - $msg = sprintf($this->pi_getLL('ll_forgot_email_password', '', 0), $this->piVars['forgot_email'], $row['username'], $row['password']); + $msg = sprintf($this->pi_getLL('ll_forgot_email_password', '', 0), $row['email'], $row['username'], $row['password']); + } else { - $msg = sprintf($this->pi_getLL('ll_forgot_email_nopassword', '', 0), $this->piVars['forgot_email']); + $msg = sprintf($this->pi_getLL('ll_forgot_email_nopassword', '', 0), $postData['forgot_email']); } - - // Generate new password with md5 and save it in user record - if ($GLOBALS['TYPO3_DB']->sql_num_rows($res) && t3lib_extMgm::isLoaded('kb_md5fepw')) { - $newPass = $this->generatePassword(8); - $res = $GLOBALS['TYPO3_DB']->exec_UPDATEquery( - 'fe_users', - 'uid=' . $row['uid'], - array('password' => md5($newPass)) - ); - $msg = sprintf($this->pi_getLL('ll_forgot_email_password', '', 0),$this->piVars['forgot_email'], $row['username'], $newPass); + if ($row) { + // generate an email with the hashed link + $error = $this->generateAndSendHash($row); } + // generate message + if ($error) { + $markerArray['###STATUS_MESSAGE###'] = $this->cObj->stdWrap($error, $this->conf['forgotMessage_stdWrap.']); + } else { + $markerArray['###STATUS_MESSAGE###'] = $this->cObj->stdWrap($this->pi_getLL('ll_forgot_message_emailSent', '', 1), $this->conf['forgotMessage_stdWrap.']); + } + $subpartArray['###FORGOT_FORM###'] = ''; - $this->cObj->sendNotifyEmail($msg, $this->piVars['forgot_email'], '', $this->conf['email_from'], $this->conf['email_fromName'], $this->conf['replyTo']); - $markerArray['###STATUS_MESSAGE###'] = $this->cObj->stdWrap(sprintf($this->pi_getLL('ll_forgot_message_emailSent', '', 1), '' . htmlspecialchars($this->piVars['forgot_email']) .''), $this->conf['forgotMessage_stdWrap.']); - $subpartArray['###FORGOT_FORM###'] = ''; - } else { //wrong email - $markerArray['###STATUS_MESSAGE###'] = $this->getDisplayText('forgot_message',$this->conf['forgotMessage_stdWrap.']); + $markerArray['###STATUS_MESSAGE###'] = $this->getDisplayText('forgot_message', $this->conf['forgotMessage_stdWrap.']); $markerArray['###BACKLINK_LOGIN###'] = ''; } } else { - $markerArray['###STATUS_MESSAGE###'] = $this->getDisplayText('forgot_message',$this->conf['forgotMessage_stdWrap.']); + $markerArray['###STATUS_MESSAGE###'] = $this->getDisplayText('forgot_message', $this->conf['forgotMessage_stdWrap.']); $markerArray['###BACKLINK_LOGIN###'] = ''; } @@ -181,16 +192,177 @@ $markerArray['###STATUS_HEADER###'] = $this->getDisplayText('forgot_header',$this->conf['forgotHeader_stdWrap.']); $markerArray['###LEGEND###'] = $this->pi_getLL('send_password', '', 1); - $markerArray['###ACTION_URI###'] = $this->getPageLink('',array($this->prefixId.'[forgot]'=>1),true); + $markerArray['###ACTION_URI###'] = $this->getPageLink('', array($this->prefixId . '[forgot]'=>1), true); $markerArray['###EMAIL_LABEL###'] = $this->pi_getLL('your_email', '', 1); $markerArray['###FORGOT_PASSWORD_ENTEREMAIL###'] = $this->pi_getLL('forgot_password_enterEmail', '', 1); $markerArray['###FORGOT_EMAIL###'] = $this->prefixId.'[forgot_email]'; $markerArray['###SEND_PASSWORD###'] = $this->pi_getLL('send_password', '', 1); + $markerArray['###DATA_LABEL###'] = $this->pi_getLL('ll_enter_your_data', '', 1); + + + + $markerArray = array_merge($markerArray, $this->getUserFieldMarkers()); + + // generate hash + $hash = md5($this->generatePassword(3)); + $markerArray['###FORGOTHASH###'] = $hash; + // set hash in feuser session + $GLOBALS["TSFE"]->fe_user->setKey('ses', 'forgot_hash', array('forgot_hash' => $hash)); + + return $this->cObj->substituteMarkerArrayCached($subpart, $markerArray, $subpartArray, $linkpartArray); } /** + * generates a hashed link and send it with email + * + * @return string The content. + */ + protected function changePassword() { + + $subpart = $this->cObj->getSubpart($this->template, '###TEMPLATE_CHANGEPASSWORD###'); + $subpartArray = $linkpartArray = array(); + + $markerArray['###STATUS_HEADER###'] = $this->getDisplayText('change_password_header',$this->conf['changePasswordHeader_stdWrap.']); + $markerArray['###STATUS_MESSAGE###'] = sprintf($this->getDisplayText('change_password_message',$this->conf['changePasswordMessage_stdWrap.']), $minLenght); + + $uid = $this->piVars['user']; + $piHash = $this->piVars['forgothash']; + + $hash = explode('|', $piHash); + if (intval($uid) == 0) { + $markerArray['###STATUS_MESSAGE###'] = $this->getDisplayText('change_password_notvalid_message',$this->conf['changePasswordMessage_stdWrap.']); + $subpartArray['###CHANGEPASSWORD_FORM###'] = ''; + } else { + $user = $this->pi_getRecord('fe_users', intval($uid)); + $userHash = $user['felogin_forgotHash']; + $compareHash = explode('|', $userHash); + + if (!$compareHash || !$compareHash[1] || $compareHash[0] < time() || $hash[0] != $compareHash[0] || md5($hash[1]) != $compareHash[1]) { + $markerArray['###STATUS_MESSAGE###'] = $this->getDisplayText('change_password_notvalid_message',$this->conf['changePasswordMessage_stdWrap.']); + $subpartArray['###CHANGEPASSWORD_FORM###'] = ''; + } else { + // all is fine, continue with new password + $done = false; + $postData = t3lib_div::_POST($this->prefixId); + $minLenght = intval($this->conf['newPasswordMinLength']) ? intval($this->conf['newPasswordMinLength']) : 6; + + + if ($postData['changepasswordsubmit']) { + if (strlen($postData['password1']) < $minLenght) { + $markerArray['###STATUS_MESSAGE###'] = sprintf($this->getDisplayText('change_password_tooshort_message', $this->conf['changePasswordMessage_stdWrap.']), $minLenght); + } elseif ($postData['password1'] != $postData['password2']) { + $markerArray['###STATUS_MESSAGE###'] = sprintf($this->getDisplayText('change_password_notequal_message', $this->conf['changePasswordMessage_stdWrap.']), $minLenght); + } else { + // + $newPass = $postData['password1']; + + // salt password + if (t3lib_extMgm::isLoaded('kb_md5fepw')) { + $newPass = md5($newPass); + } elseif (t3lib_extMgm::isLoaded('t3sec_saltedpw')) { + require_once t3lib_extMgm::extPath('t3sec_saltedpw').'res/lib/class.tx_t3secsaltedpw_phpass.php'; + + $objPHPass = t3lib_div::makeInstance('tx_t3secsaltedpw_phpass'); + $newPass = $objPHPass->getHashedPassword($newPass); + } + + // save new password and clear DB-hash + $res = $GLOBALS['TYPO3_DB']->exec_UPDATEquery( + 'fe_users', + 'uid=' . $user['uid'], + array('password' => $newPass, 'felogin_forgotHash' => '') + ); + $markerArray['###STATUS_MESSAGE###'] = $this->getDisplayText('change_password_done_message', $this->conf['changePasswordMessage_stdWrap.']); + $done = true; + $subpartArray['###CHANGEPASSWORD_FORM###'] = ''; + } + } + + if (!$done) { + // Change password form + $markerArray['###ACTION_URI###'] = $this->pi_getPageLink($GLOBALS['TSFE']->id, '', array( + $this->prefixId . '[user]' => $user['uid'], + $this->prefixId . '[forgothash]' => $piHash + )); + $markerArray['###LEGEND###'] = $this->pi_getLL('change_password', '', 1); + $markerArray['###NEWPASSWORD1_LABEL###'] = $this->pi_getLL('newpassword_label1', '', 1); + $markerArray['###NEWPASSWORD2_LABEL###'] = $this->pi_getLL('newpassword_label2', '', 1); + $markerArray['###NEWPASSWORD1###'] = $this->prefixId . '[password1]'; + $markerArray['###NEWPASSWORD2###'] = $this->prefixId . '[password2]'; + $markerArray['###STORAGE_PID###'] = $this->spid; + $markerArray['###SEND_PASSWORD###'] = $this->pi_getLL('change_password', '', 1); + $markerArray['###FORGOTHASH###'] = $piHash; + } + } + } + + return $this->cObj->substituteMarkerArrayCached($subpart, $markerArray, $subpartArray, $linkpartArray); + } + + /** + * generates a hashed link and send it with email + * + * @param array $row contains user data + * @return string Empty string with success, error message with no success + */ + protected function generateAndSendHash($row) { + $hours = intval($this->conf['forgotLinkHashValidTime']) > 0 ? intval($this->conf['forgotLinkHashValidTime']) : 24; + $validEnd = time() + 3600 * $hours; + $validEndString = date('Y-m-d H:i', $validEnd); + + $hash = md5(rand()); + $randHash = $validEnd . '|' . $hash; + $randHashDB = $validEnd . '|' . md5($hash); + + //write hash to DB + $res = $GLOBALS['TYPO3_DB']->exec_UPDATEquery('fe_users', 'uid=' . $row['uid'], array('felogin_forgotHash' => $randHashDB)); + + // send hashlink to user + $this->conf['linkPrefix'] = -1; + $isAbsRelPrefix = !empty($GLOBALS['TSFE']->tmpl->setup['config.']['absRefPrefix']); + $isBaseURL = !empty($GLOBALS['TSFE']->tmpl->setup['config.']['baseURL']); + $isFeloginBaseURL = !empty($this->conf['feloginBaseURL']); + + if ($isFeloginBaseURL) { + // first priority + $this->conf['linkPrefix'] = $this->conf['feloginBaseURL']; + } else { + if ($isBaseURL) { + // 3rd priority + $this->conf['linkPrefix'] = $GLOBALS['TSFE']->tmpl->setup['config.']['baseURL']; + } + if ($isAbsRelPrefix) { + // 2nd priority - no prefix is needed + $this->conf['linkPrefix'] = ''; + } + } + + if ($this->conf['linkPrefix'] == -1) { + // no preix is set, return the error + return $this->pi_getLL('ll_change_password_nolinkprefix_message'); + } + + $link = $this->conf['linkPrefix'] . $this->pi_getPageLink($GLOBALS['TSFE']->id, '', array( + $this->prefixId . '[user]' => $row['uid'], + $this->prefixId . '[forgothash]' => $randHash + )); + + $msg = sprintf($this->pi_getLL('ll_forgot_email_password', '', 0), $row['username'], $link, $validEndString); + + // no RDCT - Links for security reasons + $oldSetting = $GLOBALS['TSFE']->tmpl->setup['config.']['notification_email_urlmode']; + $GLOBALS['TSFE']->tmpl->setup['config.']['notification_email_urlmode'] = 0; + // send the email + $this->cObj->sendNotifyEmail($msg, $row['email'], '', $this->conf['email_from'], $this->conf['email_fromName'], $this->conf['replyTo']); + // restore settings + $GLOBALS['TSFE']->tmpl->setup['config.']['notification_email_urlmode'] = $oldSetting; + + return ''; + } + + /** * Shows logout form * * @return string The content. @@ -199,8 +371,9 @@ $subpart = $this->cObj->getSubpart($this->template, '###TEMPLATE_LOGOUT###'); $subpartArray = $linkpartArray = array(); - $markerArray['###STATUS_HEADER###'] = $this->getDisplayText('status_header',$this->conf['logoutHeader_stdWrap.']); - $markerArray['###STATUS_MESSAGE###']=$this->getDisplayText('status_message',$this->conf['logoutMessage_stdWrap.']);$this->cObj->stdWrap($this->flexFormValue('message','s_status'),$this->conf['logoutMessage_stdWrap.']); + $markerArray['###STATUS_HEADER###'] = $this->getDisplayText('status_header', $this->conf['logoutHeader_stdWrap.']); + $markerArray['###STATUS_MESSAGE###'] = $this->getDisplayText('status_message', $this->conf['logoutMessage_stdWrap.']); + $this->cObj->stdWrap($this->flexFormValue('message','s_status'),$this->conf['logoutMessage_stdWrap.']); $markerArray['###LEGEND###'] = $this->pi_getLL('logout', '', 1); $markerArray['###ACTION_URI###'] = $this->getPageLink('',array(),true); @@ -209,7 +382,8 @@ $markerArray['###STORAGE_PID###'] = $this->spid; $markerArray['###USERNAME###'] = htmlspecialchars($GLOBALS['TSFE']->fe_user->user['username']); $markerArray['###USERNAME_LABEL###'] = $this->pi_getLL('username', '', 1); - + $markerArray = array_merge($markerArray, $this->getUserFieldMarkers()); + if ($this->redirectUrl) { // use redirectUrl for action tag because of possible access restricted pages $markerArray['###ACTION_URI###'] = htmlspecialchars($this->redirectUrl); @@ -235,7 +409,8 @@ if($this->userIsLoggedIn) { // login success $markerArray['###STATUS_HEADER###'] = $this->getDisplayText('success_header',$this->conf['successHeader_stdWrap.']); - $markerArray['###STATUS_MESSAGE###'] = str_replace('###USER###',htmlspecialchars($GLOBALS['TSFE']->fe_user->user['username']),$this->getDisplayText('success_message',$this->conf['successMessage_stdWrap.'])); + $markerArray['###STATUS_MESSAGE###'] = $this->getDisplayText('success_message', $this->conf['successMessage_stdWrap.']); + $markerArray = array_merge($markerArray, $this->getUserFieldMarkers()); $subpartArray['###LOGIN_FORM###'] = ''; // Hook for general actions after after login has been confirmed (by Thomas Danzl ) @@ -297,7 +472,8 @@ $markerArray['###STORAGE_PID###'] = $this->spid; $markerArray['###USERNAME_LABEL###'] = $this->pi_getLL('username', '', 1); $markerArray['###REDIRECT_URL###'] = $gpRedirectUrl ? htmlspecialchars($gpRedirectUrl) : htmlspecialchars($this->redirectUrl); - + $markerArray = array_merge($markerArray, $this->getUserFieldMarkers()); + if ($this->flexFormValue('showForgotPassword','sDEF') || $this->conf['showForgotPasswordLink']) { $linkpartArray['###FORGOT_PASSWORD_LINK###'] = explode('|',$this->getPageLink('|',array($this->prefixId.'[forgot]'=>1))); $markerArray['###FORGOT_PASSWORD###'] = $this->pi_getLL('ll_forgot_header', '', 1); @@ -338,7 +514,7 @@ $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery( 'felogin_redirectPid', $GLOBALS['TSFE']->fe_user->usergroup_table, - 'felogin_redirectPid!="" AND uid IN ('.implode(',',$groupData['uid']).')' + 'felogin_redirectPid!="" AND uid IN (' . implode(',', $groupData['uid']) . ')' ); if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_row($res)) { $redirect_url = $this->pi_getPageLink($row[0],array(),true); // take the first group with a redirect page @@ -351,12 +527,12 @@ $GLOBALS['TSFE']->fe_user->userid_column . '=' . $GLOBALS['TSFE']->fe_user->user['uid'] . ' AND felogin_redirectPid!=""' ); if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_row($res)) { - $redirect_url = $this->pi_getPageLink($row[0],array(),true); + $redirect_url = $this->pi_getPageLink($row[0], array(), true); } break; case 'login': if ($this->conf['redirectPageLogin']) { - $redirect_url = $this->pi_getPageLink(intval($this->conf['redirectPageLogin']),array(),true); + $redirect_url = $this->pi_getPageLink(intval($this->conf['redirectPageLogin']), array(), true); } break; case 'getpost': @@ -448,7 +624,7 @@ protected function mergeflexFormValuesIntoConf() { $flex = array(); if ($this->flexFormValue('showForgotPassword', 'sDEF')) { - $flex['showForgotPassword'] = $this->flexFormValue('showForgotPassword','sDEF'); + $flex['showForgotPassword'] = $this->flexFormValue('showForgotPassword', 'sDEF'); } if ($this->flexFormValue('showPermaLogin', 'sDEF')) { @@ -519,11 +695,11 @@ * * @return string link or url */ - protected function getPageLink($label, $piVars,$returnUrl = false) { + protected function getPageLink($label, $piVars, $returnUrl = false) { $additionalParams = ''; if (count($piVars)) { - foreach($piVars as $key=>$val) { + foreach($piVars as $key => $val) { $additionalParams .= '&' . $key . '=' . $val; } } @@ -554,20 +730,20 @@ protected function getPreserveGetVars() { $params = ''; - $preserveVars =! ($this->conf['preserveGETvars'] || $this->conf['preserveGETvars']=='all' ? array() : implode(',', (array)$this->conf['preserveGETvars'])); + $preserveVars =! ($this->conf['preserveGETvars'] || $this->conf['preserveGETvars'] == 'all' ? array() : implode(',', (array)$this->conf['preserveGETvars'])); $getVars = t3lib_div::_GET(); - foreach ($getVars as $key=>$val) { - if (stristr($key,$this->prefixId) === false) { + foreach ($getVars as $key => $val) { + if (stristr($key, $this->prefixId) === false) { if (is_array($val)) { - foreach ($val as $key1=>$val1) { - if ($this->conf['preserveGETvars']=='all' || in_array($key.'['.$key1.']',$preserveVars)) { - $params.='&'.$key.'['.$key1.']='.$val1; + foreach ($val as $key1 => $val1) { + if ($this->conf['preserveGETvars'] == 'all' || in_array($key . '[' . $key1 . ']', $preserveVars)) { + $params .= '&' . $key . '[' . $key1 . ']=' . $val1; } } } else { - if (!in_array($key,array('id','no_cache','logintype','redirect_url','cHash'))) { - $params.='&'.$key.'='.$val; + if (!in_array($key,array('id', 'no_cache', 'logintype', 'redirect_url', 'cHash'))) { + $params .= '&' . $key . '=' . $val; } } } @@ -588,9 +764,9 @@ while ($len--) { $char = rand(0,35); if ($char < 10) { - $pass .= ''.$char; + $pass .= '' . $char; } else { - $pass .= chr($char-10+97); + $pass .= chr($char - 10 + 97); } } return $pass; @@ -604,13 +780,34 @@ * @return string label text */ protected function getDisplayText($label, $stdWrapArray=array()) { - return $this->flexFormValue($label,'s_messages') ? $this->cObj->stdWrap($this->flexFormValue($label,'s_messages'),$stdWrapArray) : $this->cObj->stdWrap($this->pi_getLL('ll_'.$label, '', 1), $stdWrapArray); + $text = $this->flexFormValue($label, 's_messages') ? $this->cObj->stdWrap($this->flexFormValue($label, 's_messages'), $stdWrapArray) : $this->cObj->stdWrap($this->pi_getLL('ll_'.$label, '', 1), $stdWrapArray); + $replace = $this->getUserFieldMarkers(); + return strtr($text, $replace); } + + /** + * Returns Array of markers filled with user fields + * + * @return array marker array + */ + protected function getUserFieldMarkers() { + $marker = array(); + // replace markers with fe_user data + if ($GLOBALS['TSFE']->fe_user->user) { + // all fields of fe_user will be replaced, scheme is ###FEUSER_FIELDNAME### + foreach ($GLOBALS['TSFE']->fe_user->user as $field => $value) { + $marker['###FEUSER_' . t3lib_div::strtoupper($field) . '###'] = $this->cObj->stdWrap($value, $this->conf['userfields.'][$field . '.']); + } + // add ###USER### for compatibility + $marker['###USER###'] = $marker['###FEUSER_USERNAME###']; + } + return $marker; + } } -if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/felogin/pi1/class.tx_felogin_pi1.php']) { +if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/felogin/pi1/class.tx_felogin_pi1.php']) { include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/felogin/pi1/class.tx_felogin_pi1.php']); } Index: typo3/sysext/felogin/pi1/locallang.xml =================================================================== --- typo3/sysext/felogin/pi1/locallang.xml (revision 4595) +++ typo3/sysext/felogin/pi1/locallang.xml (working copy) @@ -16,34 +16,42 @@ +Another possibility is that cookies might be disabled in your web browser. - + + + + + + + + + + + - Index: typo3/sysext/felogin/template.html =================================================================== --- typo3/sysext/felogin/template.html (revision 4595) +++ typo3/sysext/felogin/template.html (working copy) @@ -141,10 +141,13 @@
+
+ +
###LEGEND###
- +
@@ -158,7 +161,33 @@ + +###STATUS_HEADER### +###STATUS_MESSAGE### + + +
+ ###LEGEND### +
+ + +
+
+ + +
+
+ +
+
+ + + + + + +