Project

General

Profile

Bug #21564 ยป 0012608.patch

Administrator Admin, 2009-11-17 18:54

View differences:

typo3/sysext/setup/mod/index.php (Arbeitskopie)
protected $tsFieldConf;
protected $passwordIsUpdated = 0;
protected $passwordIsUpdated = FALSE;
protected $passwordIsSubmitted = FALSE;
protected $setupIsUpdated = FALSE;
......
// First check if something is submittet in the data-array from POST vars
$d = t3lib_div::_POST('data');
$columns = $GLOBALS['TYPO3_USER_SETTINGS']['columns'];
$beUserId = $BE_USER->user['uid'];
$storeRec = array();
if (is_array($d)) {
......
foreach($columns as $field => $config) {
if ($config['table']) {
if ($config['table'] == 'be_users' && !in_array($field, array('password', 'password2', 'email', 'realName', 'admin'))) {
if (!isset($config['access']) || $this->checkAccess($config)) {
$storeRec['be_users'][$BE_USER->user['uid']][$field] = $d['be_users'][$field];
if (!isset($config['access']) || $this->checkAccess($config) && $BE_USER->user[$field] !== $d['be_users'][$field]) {
$storeRec['be_users'][$beUserId][$field] = $d['be_users'][$field];
$BE_USER->user[$field] = $d['be_users'][$field];
}
}
......
// Personal data for the users be_user-record (email, name, password...)
// If email and name is changed, set it in the users record:
$be_user_data = $d['be_users'];
$this->passwordIsUpdated = strlen($be_user_data['password'].$be_user_data['password2'])>0 ? -1 : 0;
$passwordIsConfirmed = ($this->passwordIsUpdated && $be_user_data['password'] === $be_user_data['password2']);
$this->passwordIsSubmitted = (strlen($be_user_data['password']) > 0);
$passwordIsConfirmed = ($this->passwordIsSubmitted && $be_user_data['password'] === $be_user_data['password2']);
if ($be_user_data['email']!=$BE_USER->user['email']
|| $be_user_data['realName']!=$BE_USER->user['realName']
|| $passwordIsConfirmed
) {
// Update the real name:
if ($be_user_data['realName'] !== $BE_USER->user['realName']) {
$BE_USER->user['realName'] = $storeRec['be_users'][$beUserId]['realName'] = substr($be_user_data['realName'], 0, 80);
}
// Update the email address:
if ($be_user_data['email'] !== $BE_USER->user['email']) {
$BE_USER->user['email'] = $storeRec['be_users'][$beUserId]['email'] = substr($be_user_data['email'], 0, 80);
}
// Update the password:
if ($passwordIsConfirmed) {
$storeRec['be_users'][$beUserId]['password'] = $be_user_data['password2'];
$this->passwordIsUpdated = TRUE;
}
$BE_USER->user['realName'] = $storeRec['be_users'][$BE_USER->user['uid']]['realName'] = substr($be_user_data['realName'],0,80);
$BE_USER->user['email'] = $storeRec['be_users'][$BE_USER->user['uid']]['email'] = substr($be_user_data['email'],0,80);
if ($passwordIsConfirmed) {
$storeRec['be_users'][$BE_USER->user['uid']]['password'] = $be_user_data['password2'];
$this->passwordIsUpdated = 1;
}
}
// Persist data if something has changed:
if (count($storeRec)) {
// Make instance of TCE for storing the changes.
$tce = t3lib_div::makeInstance('t3lib_TCEmain');
......
$tce->bypassWorkspaceRestrictions = TRUE; // This is to make sure that the users record can be updated even if in another workspace. This is tolerated.
$tce->process_datamap();
unset($tce);
$this->setupIsUpdated = TRUE;
if (!$this->passwordIsUpdated || count($storeRec['be_users'][$beUserId]) > 1) {
$this->setupIsUpdated = TRUE;
}
}
}
}
......
$this->content .= $flashMessage->render();
}
// If password is updated, output whether it failed or was OK.
if ($this->passwordIsUpdated) {
if ($this->passwordIsUpdated > 0) {
if ($this->passwordIsSubmitted) {
if ($this->passwordIsUpdated) {
$flashMessage = t3lib_div::makeInstance(
't3lib_FlashMessage',
$LANG->getLL('newPassword_ok'),
    (1-1/1)