1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-01 20:30:39 +02:00

Remove old way to store user preferences sytem-wide

This commit is contained in:
SecretR
2014-10-24 07:37:03 +03:00
parent e636fba0be
commit 85d6ec37f7
5 changed files with 19 additions and 13 deletions

View File

@@ -343,8 +343,8 @@ class users_admin_ui extends e_admin_ui
$new_data['user_password'] = $old_data['user_password']; $new_data['user_password'] = $old_data['user_password'];
} }
else else
{ {
$new_data['user_password'] = md5($new_data['user_password']); //TODO add support for salted passwords etc. $new_data['user_password'] = md5($new_data['user_password']); //TODO add support for salted passwords etc.
} }
if(!empty($new_data['perms'])) if(!empty($new_data['perms']))
@@ -376,7 +376,7 @@ class users_admin_ui extends e_admin_ui
} }
} }
else else
{ {
$update['WHERE'] = 'user_extended_id='. intval($new_data['submit_value']); $update['WHERE'] = 'user_extended_id='. intval($new_data['submit_value']);
if(e107::getDb()->update('user_extended',$update)) if(e107::getDb()->update('user_extended',$update))
@@ -387,7 +387,7 @@ class users_admin_ui extends e_admin_ui
{ {
e107::getMessage()->addError('Extended Fields Update Failed'); //TODO Replace with Generic or existing LAN. e107::getMessage()->addError('Extended Fields Update Failed'); //TODO Replace with Generic or existing LAN.
e107::getMessage()->addDebug(print_a($update,true)); e107::getMessage()->addDebug(print_a($update,true));
} }
} }
} }
@@ -1213,7 +1213,10 @@ class users_admin_ui extends e_admin_ui
if ($userMethods->needEmailPassword()) if ($userMethods->needEmailPassword())
{ {
// Save separate password encryption for use with email address // Save separate password encryption for use with email address
$user_data['user_prefs'] = serialize(array('email_password' => $userMethods->HashPassword($savePassword, $user_data['user_email']))); $user_prefs = e107::getArrayStorage()->unserialize($user_data['user_prefs']);
$user_prefs['email_password'] = $userMethods->HashPassword($savePassword, $user_data['user_email']);
$user_data['user_prefs'] = e107::getArrayStorage()->serialize($user_prefs);
unset($user_prefs);
} }
$userMethods->userClassUpdate($allData['data'], 'userall'); $userMethods->userClassUpdate($allData['data'], 'userall');

View File

@@ -403,8 +403,9 @@ class userlogin
if ($this->lookEmail && varsettrue($pref['passwordEncoding'])) if ($this->lookEmail && varsettrue($pref['passwordEncoding']))
{ {
$tmp = unserialize($this->userData['user_prefs']); $tmp = e107::getArrayStorage()->unserialize($this->userData['user_prefs']);
$requiredPassword = varset($tmp['email_password'],$this->userData['user_password']); // Use email-specific password if set. Otherwise, 'normal' one might work if(!$tmp && $this->userData['user_prefs']) $tmp = unserialize($this->userData['user_prefs']); // try old storage type
$requiredPassword = varset($tmp['email_password'], $this->userData['user_password']); // Use email-specific password if set. Otherwise, 'normal' one might work
unset($tmp); unset($tmp);
} }
else else

View File

@@ -177,8 +177,9 @@ if (isset($_POST['GetOnWithIt']))
$recordCount++; $recordCount++;
$newData = array(); $newData = array();
$newPrefs = ''; $newPrefs = '';
$user_prefs = unserialize($row['user_prefs']); $user_prefs = e107::getArrayStorage()->unserialize($row['user_prefs']);
if ($saltConvert) if(!$user_prefs && $row['user_prefs']) $user_prefs = unserialize($row['user_prefs']);
if ($saltConvert)
{ {
if ($user_info->canConvert($row['user_password'])) if ($user_info->canConvert($row['user_password']))
{ {
@@ -204,7 +205,7 @@ if (isset($_POST['GetOnWithIt']))
unset($user_prefs['email_password']); unset($user_prefs['email_password']);
$emailProcess++; $emailProcess++;
} }
if (count($user_prefs)) $newPrefs = serialize($user_prefs); else $newPrefs = ''; if (count($user_prefs)) $newPrefs = e107::getArrayStorage()->serialize($user_prefs); else $newPrefs = '';
if($newPrefs != $user_prefs) if($newPrefs != $user_prefs)
{ {
$newData['user_prefs'] = $newPrefs; $newData['user_prefs'] = $newPrefs;

View File

@@ -569,7 +569,8 @@ if (isset($_POST['register']) && $pref['user_reg'] == 1)
if (vartrue($pref['allowEmailLogin'])) if (vartrue($pref['allowEmailLogin']))
{ // Need to create separate password for email login { // Need to create separate password for email login
$allData['data']['user_prefs'] = serialize(array('email_password' => $userMethods->HashPassword($savePassword, $allData['data']['user_email']))); //$allData['data']['user_prefs'] = serialize(array('email_password' => $userMethods->HashPassword($savePassword, $allData['data']['user_email'])));
$allData['data']['user_prefs'] = e107::getArrayStorage()->serialize(array('email_password' => $userMethods->HashPassword($savePassword, $allData['data']['user_email'])));
} }
$allData['data']['user_join'] = time(); $allData['data']['user_join'] = time();

View File

@@ -558,9 +558,9 @@ if ($dataToSave)
$changedUserData['user_password'] = $sql->escape($userMethods->HashPassword($savePassword, $loginname), false); $changedUserData['user_password'] = $sql->escape($userMethods->HashPassword($savePassword, $loginname), false);
if (varset($pref['allowEmailLogin'], FALSE)) if (varset($pref['allowEmailLogin'], FALSE))
{ {
$user_prefs = unserialize($udata['user_prefs']); $user_prefs = e107::getArrayStorage()->unserialize($udata['user_prefs']);
$user_prefs['email_password'] = $userMethods->HashPassword($savePassword, $email); $user_prefs['email_password'] = $userMethods->HashPassword($savePassword, $email);
$changedUserData['user_prefs'] = serialize($user_prefs); $changedUserData['user_prefs'] = e107::getArrayStorage()->serialize($user_prefs);
} }
} }
else else