1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-02 12:48:26 +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

@@ -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,7 +403,8 @@ 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']);
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 $requiredPassword = varset($tmp['email_password'], $this->userData['user_password']); // Use email-specific password if set. Otherwise, 'normal' one might work
unset($tmp); unset($tmp);
} }

View File

@@ -177,7 +177,8 @@ 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(!$user_prefs && $row['user_prefs']) $user_prefs = unserialize($row['user_prefs']);
if ($saltConvert) 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