diff --git a/core/lib/class.plx.admin.php b/core/lib/class.plx.admin.php
index cb4f28892..51747a416 100644
--- a/core/lib/class.plx.admin.php
+++ b/core/lib/class.plx.admin.php
@@ -439,8 +439,8 @@ public function editUsers($content, $action=false) {
$this->aUsers[$user_id]['lang'] = (isset($this->aUsers[$user_id]['lang'])?$this->aUsers[$user_id]['lang']:$this->aConf['default_lang']);
$this->aUsers[$user_id]['infos'] = (isset($this->aUsers[$user_id]['infos'])?$this->aUsers[$user_id]['infos']:'');
- $this->aUsers[$user_id]['password_token'] = trim($content[$user_id.'_password_token']);
- $this->aUsers[$user_id]['password_token_expiry'] = trim($content[$user_id.'_password_token_expiry']);
+ $this->aUsers[$user_id]['password_token'] = (isset($this->aUsers[$user_id]['_password_token'])?$this->aUsers[$user_id]['_password_token']:'');
+ $this->aUsers[$user_id]['password_token_expiry'] = (isset($this->aUsers[$user_id]['_password_token_expiry'])?$this->aUsers[$user_id]['_password_token_expiry']:'');
# Hook plugins
eval($this->plxPlugins->callHook('plxAdminEditUsersUpdate'));
$action = true;
diff --git a/update/update_5.8.1.php b/update/update_5.8.1.php
index ab2ec5b09..d5cce1ff7 100755
--- a/update/update_5.8.1.php
+++ b/update/update_5.8.1.php
@@ -29,4 +29,27 @@ public function step1() {
}
return true;
}
+
+ /**
+ * Update users file with new fields password_token, password_token_expiry
+ * @return boolean
+ */
+ public function step2() {
+ echo L_UPDATE_FILE." (".path('XMLFILE_USERS').")
";
+ $data = file_get_contents(path('XMLFILE_USERS'));
+ $tag = 'user';
+ if(preg_match_all('{<'.$tag.'[^>]*>(.*?)'.$tag.'>}', $data, $matches, PREG_PATTERN_ORDER)) {
+ foreach($matches[0] as $match) {
+ if(!preg_match('//', $match)) {
+ $str = str_replace(''.$tag.'>', ''.$tag.'>', $match);
+ $data = str_replace($match, $str, $data);
+ }
+ }
+ if(!plxUtils::write($data, path('XMLFILE_CATEGORIES'))) {
+ echo ''.L_UPDATE_ERR_FILE.'
';
+ return false;
+ }
+ }
+ return true;
+ }
}
\ No newline at end of file