summaryrefslogtreecommitdiff
path: root/lib/plugins/authplain/auth.php
diff options
context:
space:
mode:
authorPatrick Brown <ptbrown@whoopdedo.org>2015-05-07 21:10:22 -0400
committerPatrick Brown <ptbrown@whoopdedo.org>2015-05-07 21:10:22 -0400
commitd0d224a82eddf30aa6daead4796cb10dd0466767 (patch)
treed04692b0379451db55b7dc556dee7be7846d3cc8 /lib/plugins/authplain/auth.php
parent699e3c4900f2d6cc860a3587a05798cd23b7944d (diff)
parentcffb4528cea1b9e7e03dc724aaa9719dbd6e23c9 (diff)
downloadrpg-d0d224a82eddf30aa6daead4796cb10dd0466767.tar.gz
rpg-d0d224a82eddf30aa6daead4796cb10dd0466767.tar.bz2
Merge branch 'master' into ioreplaceinfile
Diffstat (limited to 'lib/plugins/authplain/auth.php')
-rw-r--r--lib/plugins/authplain/auth.php30
1 files changed, 18 insertions, 12 deletions
diff --git a/lib/plugins/authplain/auth.php b/lib/plugins/authplain/auth.php
index 35cf7a802..8ec632dad 100644
--- a/lib/plugins/authplain/auth.php
+++ b/lib/plugins/authplain/auth.php
@@ -134,7 +134,10 @@ class auth_plugin_authplain extends DokuWiki_Auth_Plugin {
global $config_cascade;
// user mustn't already exist
- if($this->getUserData($user) !== false) return false;
+ if($this->getUserData($user) !== false) {
+ msg($this->getLang('userexists'), -1);
+ return false;
+ }
$pass = auth_cryptPassword($pwd);
@@ -144,16 +147,13 @@ class auth_plugin_authplain extends DokuWiki_Auth_Plugin {
// prepare user line
$userline = $this->_createUserLine($user, $pass, $name, $mail, $grps);
- if(io_saveFile($config_cascade['plainauth.users']['default'], $userline, true)) {
- $this->users[$user] = compact('pass', 'name', 'mail', 'grps');
- return $pwd;
+ if(!io_saveFile($config_cascade['plainauth.users']['default'], $userline, true)) {
+ msg($this->getLang('writefail'), -1);
+ return null;
}
- msg(
- 'The '.$config_cascade['plainauth.users']['default'].
- ' file is not writable. Please inform the Wiki-Admin', -1
- );
- return null;
+ $this->users[$user] = compact('pass', 'name', 'mail', 'grps');
+ return $pwd;
}
/**
@@ -169,7 +169,10 @@ class auth_plugin_authplain extends DokuWiki_Auth_Plugin {
global $config_cascade;
// sanity checks, user must already exist and there must be something to change
- if(($userinfo = $this->getUserData($user)) === false) return false;
+ if(($userinfo = $this->getUserData($user)) === false) {
+ msg($this->getLang('usernotexists'), -1);
+ return false;
+ }
if(!is_array($changes) || !count($changes)) return true;
// update userinfo with new data, remembering to encrypt any password
@@ -218,7 +221,10 @@ class auth_plugin_authplain extends DokuWiki_Auth_Plugin {
if(empty($deleted)) return 0;
$pattern = '/^('.join('|', $deleted).'):/';
- io_deleteFromFile($config_cascade['plainauth.users']['default'], $pattern, true);
+ if (!io_deleteFromFile($config_cascade['plainauth.users']['default'], $pattern, true)) {
+ msg($this->getLang('writefail'), -1);
+ return 0;
+ }
// reload the user list and count the difference
$count = count($this->users);
@@ -402,4 +408,4 @@ class auth_plugin_authplain extends DokuWiki_Auth_Plugin {
$this->_pattern[$item] = '/'.str_replace('/', '\/', $pattern).'/i'; // allow regex characters
}
}
-} \ No newline at end of file
+}