diff options
author | matthiasgrimm <matthiasgrimm@users.sourceforge.net> | 2005-11-11 19:58:16 +0100 |
---|---|---|
committer | matthiasgrimm <matthiasgrimm@users.sourceforge.net> | 2005-11-11 19:58:16 +0100 |
commit | 630a9e82946b0369902147a0f0d41297bf32aff6 (patch) | |
tree | 87f703f93ace611dfd49d3b3b935a49b348f3d9b | |
parent | c00aef76210cc7e657a9e8a02cdacdf305c76af3 (diff) | |
download | rpg-630a9e82946b0369902147a0f0d41297bf32aff6.tar.gz rpg-630a9e82946b0369902147a0f0d41297bf32aff6.tar.bz2 |
change username fix
This patch adds support for changing the username in modifyUser() which is
needed by the user manager.
darcs-hash:20051111185816-7ef76-062a7d949beaa90981d4fef8dfa70edc9d4723e6.gz
-rw-r--r-- | inc/auth/mysql.class.php | 5 | ||||
-rw-r--r-- | inc/auth/plain.class.php | 9 |
2 files changed, 11 insertions, 3 deletions
diff --git a/inc/auth/mysql.class.php b/inc/auth/mysql.class.php index ad9d532d3..f0dde6ae0 100644 --- a/inc/auth/mysql.class.php +++ b/inc/auth/mysql.class.php @@ -164,7 +164,10 @@ class auth_mysql extends auth_basic { if($this->openDB()) { $this->lockTables("WRITE"); if (($info = $this->getUserInfo($user)) !== false) { + $newuser = $user; foreach ($changes as $field => $value) { + if ($field == 'user') + $newuser = $value; if ($field == 'pass' && !$this->cnf['encryptPass']) $value = auth_cryptPassword($value); $info[$field] = $value; // update user record @@ -172,7 +175,7 @@ class auth_mysql extends auth_basic { $rc = $this->delUser($user); // remove user from database if ($rc) - $rc = $this->addUser($user,$info['pass'],$info['name'],$info['mail'],$info['grps']); + $rc = $this->addUser($newuser,$info['pass'],$info['name'],$info['mail'],$info['grps']); if (!$rc) msg($lang['modUserFailed'], -1); } diff --git a/inc/auth/plain.class.php b/inc/auth/plain.class.php index d492463e5..140bd7519 100644 --- a/inc/auth/plain.class.php +++ b/inc/auth/plain.class.php @@ -111,13 +111,18 @@ class auth_plain extends auth_basic { if (!is_array($changes) || !count($changes)) return true; // update userinfo with new data, remembering to encrypt any password + $newuser = $user; foreach ($changes as $field => $value) { + if ($field == 'user') { + $newuser = $value; + continue; + } if ($field == 'pass') $value = auth_cryptPassword($value); $userinfo[$field] = $value; } $groups = join(',',$userinfo['grps']); - $userline = join(':',array($user, $userinfo['pass'], $userinfo['name'], $userinfo['mail'], $groups))."\n"; + $userline = join(':',array($newuser, $userinfo['pass'], $userinfo['name'], $userinfo['mail'], $groups))."\n"; if (!$this->deleteUsers(array($user))) { msg('Unable to modify user data. Please inform the Wiki-Admin',-1); @@ -131,7 +136,7 @@ class auth_plain extends auth_basic { return false; } - $this->users[$user] = $userinfo; + $this->users[$newuser] = $userinfo; return true; } |