Throw login error when LDAP connection failes or user not found in LDAP (Bug #512)
This commit is contained in:
parent
e0962a3936
commit
ad9a89eece
1 changed files with 15 additions and 14 deletions
|
@ -252,6 +252,7 @@ class kolab_auth extends rcube_plugin
|
||||||
$this->load_config();
|
$this->load_config();
|
||||||
|
|
||||||
if (!$this->init_ldap()) {
|
if (!$this->init_ldap()) {
|
||||||
|
$args['abort'] = true;
|
||||||
return $args;
|
return $args;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -268,6 +269,7 @@ class kolab_auth extends rcube_plugin
|
||||||
$loginas = trim(get_input_value('_loginas', RCUBE_INPUT_POST));
|
$loginas = trim(get_input_value('_loginas', RCUBE_INPUT_POST));
|
||||||
|
|
||||||
if (empty($user) || empty($pass)) {
|
if (empty($user) || empty($pass)) {
|
||||||
|
$args['abort'] = true;
|
||||||
return $args;
|
return $args;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -275,6 +277,7 @@ class kolab_auth extends rcube_plugin
|
||||||
$record = $this->get_user_record($user, $host);
|
$record = $this->get_user_record($user, $host);
|
||||||
|
|
||||||
if (empty($record)) {
|
if (empty($record)) {
|
||||||
|
$args['abort'] = true;
|
||||||
return $args;
|
return $args;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -339,7 +342,7 @@ class kolab_auth extends rcube_plugin
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($record)) {
|
if (empty($record)) {
|
||||||
$args['valid'] = false;
|
$args['abort'] = true;
|
||||||
return $args;
|
return $args;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -351,21 +354,19 @@ class kolab_auth extends rcube_plugin
|
||||||
$_SESSION['kolab_auth_password'] = $rcmail->encrypt($admin_pass);
|
$_SESSION['kolab_auth_password'] = $rcmail->encrypt($admin_pass);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Store UID in session for use by other plugins
|
||||||
|
$_SESSION['kolab_uid'] = is_array($record['uid']) ? $record['uid'][0] : $record['uid'];
|
||||||
|
|
||||||
// Set credentials
|
// Set credentials
|
||||||
if ($record) {
|
if ($login_attr) {
|
||||||
// Store UID in session for use by other plugins
|
$this->data['user_login'] = is_array($record[$login_attr]) ? $record[$login_attr][0] : $record[$login_attr];
|
||||||
$_SESSION['kolab_uid'] = is_array($record['uid']) ? $record['uid'][0] : $record['uid'];
|
}
|
||||||
|
if ($name_attr) {
|
||||||
|
$this->data['user_name'] = is_array($record[$name_attr]) ? $record[$name_attr][0] : $record[$name_attr];
|
||||||
|
}
|
||||||
|
|
||||||
if ($login_attr) {
|
if ($this->data['user_login']) {
|
||||||
$this->data['user_login'] = is_array($record[$login_attr]) ? $record[$login_attr][0] : $record[$login_attr];
|
$args['user'] = $this->data['user_login'];
|
||||||
}
|
|
||||||
if ($name_attr) {
|
|
||||||
$this->data['user_name'] = is_array($record[$name_attr]) ? $record[$name_attr][0] : $record[$name_attr];
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->data['user_login']) {
|
|
||||||
$args['user'] = $this->data['user_login'];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Log "Login As" usage
|
// Log "Login As" usage
|
||||||
|
|
Loading…
Add table
Reference in a new issue