summaryrefslogtreecommitdiff
path: root/lib/plugins/authmysql
diff options
context:
space:
mode:
authorPatrick Brown <ptbrown@whoopdedo.org>2015-05-06 15:31:08 -0400
committerPatrick Brown <ptbrown@whoopdedo.org>2015-05-06 15:31:08 -0400
commit8f03c311f28eaffe92893ec1a4d0b78581926e13 (patch)
tree836a2f3ee08aaad55328092a1934a64934dd64ff /lib/plugins/authmysql
parentdb9faf025cf129d15a086a803e8056e977975d76 (diff)
downloadrpg-8f03c311f28eaffe92893ec1a4d0b78581926e13.tar.gz
rpg-8f03c311f28eaffe92893ec1a4d0b78581926e13.tar.bz2
Error reporting for database auth plugins
Diffstat (limited to 'lib/plugins/authmysql')
-rw-r--r--lib/plugins/authmysql/auth.php19
-rw-r--r--lib/plugins/authmysql/lang/en/lang.php13
2 files changed, 30 insertions, 2 deletions
diff --git a/lib/plugins/authmysql/auth.php b/lib/plugins/authmysql/auth.php
index 0d423b6c9..1b7d0bfa4 100644
--- a/lib/plugins/authmysql/auth.php
+++ b/lib/plugins/authmysql/auth.php
@@ -222,6 +222,7 @@ class auth_plugin_authmysql extends DokuWiki_Auth_Plugin {
if($this->_openDB()) {
if(($info = $this->_getUserInfo($user)) !== false) {
+ msg($this->getLang('userexists'), -1);
return false; // user already exists
}
@@ -235,7 +236,13 @@ class auth_plugin_authmysql extends DokuWiki_Auth_Plugin {
$rc = $this->_addUser($user, $pwd, $name, $mail, $grps);
$this->_unlockTables();
$this->_closeDB();
- if($rc) return true;
+ if(!$rc) {
+ msg($this->getLang('writefail'));
+ return null;
+ }
+ return true;
+ } else {
+ msg($this->getLang('connectfail'), -1);
}
return null; // return error
}
@@ -279,7 +286,9 @@ class auth_plugin_authmysql extends DokuWiki_Auth_Plugin {
$rc = $this->_updateUserInfo($user, $changes);
- if($rc && isset($changes['grps']) && $this->cando['modGroups']) {
+ if(!$rc) {
+ msg($this->getLang('usernotexists'), -1);
+ } elseif(isset($changes['grps']) && $this->cando['modGroups']) {
$groups = $this->_getGroups($user);
$grpadd = array_diff($changes['grps'], $groups);
$grpdel = array_diff($groups, $changes['grps']);
@@ -295,10 +304,14 @@ class auth_plugin_authmysql extends DokuWiki_Auth_Plugin {
$rc = false;
}
}
+
+ if(!$rc) msg($this->getLang('writefail'));
}
$this->_unlockTables();
$this->_closeDB();
+ } else {
+ msg($this->getLang('connectfail'), -1);
}
return $rc;
}
@@ -328,6 +341,8 @@ class auth_plugin_authmysql extends DokuWiki_Auth_Plugin {
$this->_unlockTables();
}
$this->_closeDB();
+ } else {
+ msg($this->getLang('connectfail'), -1);
}
return $count;
}
diff --git a/lib/plugins/authmysql/lang/en/lang.php b/lib/plugins/authmysql/lang/en/lang.php
new file mode 100644
index 000000000..8313616c6
--- /dev/null
+++ b/lib/plugins/authmysql/lang/en/lang.php
@@ -0,0 +1,13 @@
+<?php
+/**
+ * English language file for authmysql plugin
+ * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
+ *
+ */
+
+$lang['connectfail'] = 'Failed to connect to database.';
+$lang['userexists'] = 'Sorry, a user with this login already exists.';
+$lang['usernotexists'] = 'Sorry, that user doesn\'t exist.';
+$lang['writefail'] = 'Unable to modify user data. Please inform the Wiki-Admin';
+
+//Setup VIM: ex: et ts=4 :