diff options
author | Andreas Gohr <andi@splitbrain.org> | 2015-07-18 13:25:17 +0200 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2015-07-18 13:25:17 +0200 |
commit | 51d83b85e139e124f20b972d632b8ba2cb3d3458 (patch) | |
tree | 13c38cdb4f2c30c68bea506e9ceb8f96a508fe75 /lib/plugins/authplain/auth.php | |
parent | b86bc28af9b961266a2caeeb86c8f6f125adc412 (diff) | |
parent | d93ba631117932f06b44535a9d6256cc8e9c4b90 (diff) | |
download | rpg-51d83b85e139e124f20b972d632b8ba2cb3d3458.tar.gz rpg-51d83b85e139e124f20b972d632b8ba2cb3d3458.tar.bz2 |
Merge pull request #1176 from splitbrain/ioreplaceinfile
Add IO function to replace lines in a file (new)
Diffstat (limited to 'lib/plugins/authplain/auth.php')
-rw-r--r-- | lib/plugins/authplain/auth.php | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/lib/plugins/authplain/auth.php b/lib/plugins/authplain/auth.php index bd46c61a7..8ec632dad 100644 --- a/lib/plugins/authplain/auth.php +++ b/lib/plugins/authplain/auth.php @@ -188,15 +188,9 @@ class auth_plugin_authplain extends DokuWiki_Auth_Plugin { $userline = $this->_createUserLine($newuser, $userinfo['pass'], $userinfo['name'], $userinfo['mail'], $userinfo['grps']); - if(!$this->deleteUsers(array($user))) { - msg($this->getLang('writefail'), -1); - return false; - } - - if(!io_saveFile($config_cascade['plainauth.users']['default'], $userline, true)) { - msg('There was an error modifying your user data. You should register again.', -1); - // FIXME, user has been deleted but not recreated, should force a logout and redirect to login page - // Should replace the delete/save hybrid modify with an atomic io_replaceInFile + if(!io_replaceInFile($config_cascade['plainauth.users']['default'], '/^'.$user.':/', $userline, true)) { + msg('There was an error modifying your user data. You may need to register again.', -1); + // FIXME, io functions should be fail-safe so existing data isn't lost $ACT = 'register'; return false; } |