summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/plugins/authad/auth.php8
-rw-r--r--lib/plugins/authad/lang/en/lang.php6
-rw-r--r--lib/plugins/authldap/auth.php8
-rw-r--r--lib/plugins/authldap/lang/en/lang.php11
-rw-r--r--lib/plugins/authmysql/auth.php19
-rw-r--r--lib/plugins/authmysql/lang/en/lang.php13
6 files changed, 55 insertions, 10 deletions
diff --git a/lib/plugins/authad/auth.php b/lib/plugins/authad/auth.php
index 40c56ef09..60c68efc4 100644
--- a/lib/plugins/authad/auth.php
+++ b/lib/plugins/authad/auth.php
@@ -522,7 +522,10 @@ class auth_plugin_authad extends DokuWiki_Auth_Plugin {
public function modifyUser($user, $changes) {
$return = true;
$adldap = $this->_adldap($this->_userDomain($user));
- if(!$adldap) return false;
+ if(!$adldap) {
+ msg($this->getLang('connectfail'), -1);
+ return false;
+ }
// password changing
if(isset($changes['pass'])) {
@@ -532,7 +535,7 @@ class auth_plugin_authad extends DokuWiki_Auth_Plugin {
if ($this->conf['debug']) msg('AD Auth: '.$e->getMessage(), -1);
$return = false;
}
- if(!$return) msg('AD Auth: failed to change the password. Maybe the password policy was not met?', -1);
+ if(!$return) msg($this->getLang('passchangefail'), -1);
}
// changing user data
@@ -554,6 +557,7 @@ class auth_plugin_authad extends DokuWiki_Auth_Plugin {
if ($this->conf['debug']) msg('AD Auth: '.$e->getMessage(), -1);
$return = false;
}
+ if(!$return) msg($this->getLang('userchangefail'), -1);
}
return $return;
diff --git a/lib/plugins/authad/lang/en/lang.php b/lib/plugins/authad/lang/en/lang.php
index 4f96a71fd..751aa9f47 100644
--- a/lib/plugins/authad/lang/en/lang.php
+++ b/lib/plugins/authad/lang/en/lang.php
@@ -6,7 +6,9 @@
* @author Andreas Gohr <gohr@cosmocode.de>
*/
-$lang['domain'] = 'Logon Domain';
-$lang['authpwdexpire'] = 'Your password will expire in %d days, you should change it soon.';
+$lang['domain'] = 'Logon Domain';
+$lang['authpwdexpire'] = 'Your password will expire in %d days, you should change it soon.';
+$lang['passchangefail'] = 'Failed to change the password. Maybe the password policy was not met?';
+$lang['connectfail'] = 'Failed to connect to Active Directory server.';
//Setup VIM: ex: et ts=4 :
diff --git a/lib/plugins/authldap/auth.php b/lib/plugins/authldap/auth.php
index 9d031c049..247a0fec2 100644
--- a/lib/plugins/authldap/auth.php
+++ b/lib/plugins/authldap/auth.php
@@ -281,14 +281,14 @@ class auth_plugin_authldap extends DokuWiki_Auth_Plugin {
// open the connection to the ldap
if(!$this->_openLDAP()){
- msg('LDAP cannot connect: '. htmlspecialchars(ldap_error($this->con)));
+ $this->_debug('LDAP cannot connect: '. htmlspecialchars(ldap_error($this->con)), 0, __LINE__, __FILE__);
return false;
}
// find the information about the user, in particular the "dn"
$info = $this->getUserData($user,true);
if(empty($info['dn'])) {
- msg('LDAP cannot find your user dn');
+ $this->_debug('LDAP cannot find your user dn', 0, __LINE__, __FILE__);
return false;
}
$dn = $info['dn'];
@@ -301,7 +301,7 @@ class auth_plugin_authldap extends DokuWiki_Auth_Plugin {
// bind with the ldap
if(!@ldap_bind($this->con, $dn, $pass)){
- msg('LDAP user bind failed: '. htmlspecialchars($dn) .': '.htmlspecialchars(ldap_error($this->con)), 0, __LINE__, __FILE__);
+ $this->_debug('LDAP user bind failed: '. htmlspecialchars($dn) .': '.htmlspecialchars(ldap_error($this->con)), 0, __LINE__, __FILE__);
return false;
}
} elseif ($this->getConf('binddn') && $this->getConf('bindpw')) {
@@ -322,7 +322,7 @@ class auth_plugin_authldap extends DokuWiki_Auth_Plugin {
// change the password
if(!@ldap_mod_replace($this->con, $dn,array('userpassword' => $hash))){
- msg('LDAP mod replace failed: '. htmlspecialchars($dn) .': '.htmlspecialchars(ldap_error($this->con)));
+ $this->_debug('LDAP mod replace failed: '. htmlspecialchars($dn) .': '.htmlspecialchars(ldap_error($this->con)), 0, __LINE__, __FILE__);
return false;
}
diff --git a/lib/plugins/authldap/lang/en/lang.php b/lib/plugins/authldap/lang/en/lang.php
new file mode 100644
index 000000000..db06efb4c
--- /dev/null
+++ b/lib/plugins/authldap/lang/en/lang.php
@@ -0,0 +1,11 @@
+<?php
+/**
+ * English language file for authldap plugin
+ * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
+ *
+ */
+
+$lang['connectfail'] = 'LDAP cannot connect: %s';
+$lang['domainfail' = 'LDAP cannot find your user dn';
+
+//Setup VIM: ex: et ts=4 :
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 :