Project

General

Profile

Feature #19742 » felogin_forget_password_changepassword_4-2-3.diff

Administrator Admin, 2008-12-26 14:24

View differences:

typo3/sysext/felogin/ext_emconf.php (working copy)
'clearCacheOnLoad' => 1,
'lockType' => '',
'author_company' => '',
'version' => '1.0.0',
'version' => '1.2.0',
'constraints' => array(
'depends' => array(
'php' => '5.1.0-0.0.0',
typo3/sysext/felogin/ext_tables.php (working copy)
--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");
typo3/sysext/felogin/ext_tables.sql (working copy)
#
# 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 ''
);
typo3/sysext/felogin/ext_typoscript_setup.txt (working copy)
#Template File
templateFile = EXT:felogin/template.html
#baseURL for the link generation
feloginBaseURL =
#wrapContentInBaseClass
wrapContentInBaseClass = 1
......
#additional fields
showForgotPasswordLink =
showPermaLogin =
# time in hours how long the sended link for forget password is valid
forgotLinkHashValidTime = 12
newPasswordMinLength = 6
welcomeHeader_stdWrap {
wrap = <h3>|</h3>
}
......
wrap = <div>|</div>
}
changePasswordHeader_stdWrap {
wrap = <h3>|</h3>
}
changePasswordMessage_stdWrap {
wrap = <div>|</div>
}
#redirect
redirectMode =
redirectFirstMethod =
typo3/sysext/felogin/locallang_db.xml (working copy)
<languageKey index="default" type="array">
<label index="tt_content.CType_pi1">Website User Login</label>
<label index="felogin_redirectPid">Redirect at Login to Page (felogin):</label>
<label index="felogin_forgotHash">Hash for forgot password</label>
<label index="tt_content.pi_flexform.general_header">General Header:</label>
<label index="tt_content.pi_flexform.general_message">General Message:</label>
<label index="tt_content.pi_flexform.redirect_header">Redirect Header:</label>
typo3/sysext/felogin/pi1/class.tx_felogin_pi1.php (working copy)
// 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'];
......
$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);
......
$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();
......
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), '<em>' . htmlspecialchars($this->piVars['forgot_email']) .'</em>'), $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###'] = '';
}
......
$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.
......
$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);
......
$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);
......
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 <thomas@danzl.org>)
......
$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);
......
$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
......
$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':
......
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')) {
......
*
* @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;
}
}
......
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;
}
}
}
......
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;
......
* @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']);
}
typo3/sysext/felogin/pi1/locallang.xml (working copy)
<label index="ll_error_header">Login failure</label>
<label index="ll_error_message">An error occurred during login. Most likely you didn't enter the username or password correctly.
Be certain that you enter them precisely as they are, including upper/lower case.
Another possibility is that cookies might be disabled in your webbrowser.</label>
Another possibility is that cookies might be disabled in your web browser.</label>
<label index="ll_success_header">Login successful</label>
<label index="ll_success_message">You are now logged in as '###USER###'</label>
<label index="ll_status_header">Current status</label>
<label index="ll_status_message">This is your current status:</label>
<label index="cookie_warning">Warning: There is a possibility that cookies are not enabled in your webbrowser! If your login disappears on your next click that is the case and you should enable cookies (or accept cookies from this website) immediately!</label>
<label index="cookie_warning">Warning: There is a possibility that cookies are not enabled in your web browser! If your login disappears on your next click that is the case and you should enable cookies (or accept cookies from this website) immediately!</label>
<label index="username">Username:</label>
<label index="password">Password:</label>
<label index="login">Login</label>
<label index="permalogin">Stay logged in:</label>
<label index="logout">Logout</label>
<label index="send_password">Send password</label>
<label index="ll_change_password_header">Change your password</label>
<label index="ll_change_password_message">Please enter your new password twice. Password needs a minimum length of %s chars.</label>
<label index="ll_change_password_nolinkprefix_message">Error: there is no prefix for the link. Please set one of the following in your typoscript template: plugin.tx_felogin_pi1.feloginBaseURL = http://yourdomain/, config.baseURL = http://yourdomain/, config.absRelPrefix = http://yourdomain/</label>
<label index="ll_change_password_notvalid_message">The link you clicked is not valid. Please repeat the forgot message procedure.</label>
<label index="ll_change_password_notequal_message">The passwords are not equal, please enter your new password twice. Password needs a minimum length of %s chars.</label>
<label index="ll_change_password_tooshort_message">The password length is too short. Please enter your new password twice. Password needs a minimum length of %s chars.</label>
<label index="ll_change_password_done_message">Your password has been saved. You can now login with your new password.</label>
<label index="change_password">Change your password</label>
<label index="newpassword_label1">Enter new password</label>
<label index="newpassword_label2">Repeat new password</label>
<label index="your_email">Your email:</label>
<label index="ll_forgot_header">Forgot your password?</label>
<label index="ll_forgot_email_password">Your password
Hi %s
<label index="ll_forgot_email_password">Your new password
Dear %s
Your username is &quot;%s&quot;
Your password is &quot;%s&quot;
</label>
<label index="ll_forgot_email_nopassword">Your password
Hi %s
to set a new password please visit this link:
%s
We couldn't find a username for this email address and so cannot send the password to you. Probably you misspelled the email address (upper/lower case makes a difference) or maybe you even didn't register yet?
The link is only valid until %s. If you do not visit the link before then, you will have to repeat the forgot password procedure.
</label>
<label index="ll_forgot_message">Please enter the email address by which you registered your user account. Then press &quot;Send password&quot; and your password will immediately be emailed to you. Make sure to spell your email address correctly.</label>
<label index="ll_forgot_message_emailSent">Your password has now been sent to the email address %s</label>
<label index="ll_forgot_message">Please enter your username or the email address stored in your account, press &quot;Send password&quot;, and your password will immediately be emailed to you. Make sure to spell your username or email address correctly.</label>
<label index="ll_forgot_message_emailSent">An email has been sent to the address stored in your account and contains a link to reset your password. If you do not receive an email, your account or email address was not found.</label>
<label index="ll_forgot_header_backToLogin">Return to login form</label>
<label index="ll_enter_your_data">Enter your username or email address:</label>
</languageKey>
</data>
</T3locallang>
typo3/sysext/felogin/template.html (working copy)
<!-- ###FORGOT_FORM### -->
<form action="###ACTION_URI###" method="post">
<div class="felogin-hidden">
<input type="hidden" name="tx_felogin_pi1[forgot_hash]" value="###FORGOTHASH###" />
</div>
<fieldset>
<legend>###LEGEND###</legend>
<div>
<label for="###FORGOT_EMAIL###">###EMAIL_LABEL###</label>
<label for="###FORGOT_EMAIL###">###DATA_LABEL###</label>
<input type="text" name="###FORGOT_EMAIL###" id="###FORGOT_EMAIL###" />
</div>
<div>
......
<!--###TEMPLATE_CHANGEPASSWORD###-->
###STATUS_HEADER###
###STATUS_MESSAGE###
<!-- ###CHANGEPASSWORD_FORM### -->
<form action="###ACTION_URI###" method="post">
<fieldset>
<legend>###LEGEND###</legend>
<div>
<label for="###NEWPASSWORD1###">###NEWPASSWORD1_LABEL###</label>
<input type="password" name="###NEWPASSWORD1###" id="###NEWPASSWORD1###" />
</div>
<div>
<label for="###NEWPASSWORD2###">###NEWPASSWORD2_LABEL###</label>
<input type="password" name="###NEWPASSWORD2###" id="###NEWPASSWORD2###" />
</div>
<div>
<input type="submit" name="tx_felogin_pi1[changepasswordsubmit]" value="###SEND_PASSWORD###" />
</div>
</fieldset>
</form>
<!-- ###CHANGEPASSWORD_FORM### -->
<!--###TEMPLATE_CHANGEPASSWORD###-->
(1-1/4)