Index: frontends/php/authentication.php =================================================================== --- frontends/php/authentication.php (revision 32376) +++ frontends/php/authentication.php (revision 32393) @@ -101,12 +101,11 @@ $config['authentication_type'] = $_REQUEST['config']; // check login/password - $login = API::User()->ldapLogin(array( - 'user' => get_request('user', $USER_DETAILS['alias']), - 'password' => get_request('user_password', ''), - 'cnf' => $ldap_cnf - )); + $ldap = new CLdap($ldap_cnf); + $ldap->connect(); + $login = $ldap->checkPass(get_request('user', $USER_DETAILS['alias']), get_request('user_password', '')); if (!$login) { + error(_('Login name or password is incorrect')); throw new Exception(); } @@ -129,12 +128,13 @@ } elseif (isset($_REQUEST['test'])) { // check login/password - $result = API::User()->ldapLogin(array( - 'user' => get_request('user', $USER_DETAILS['alias']), - 'password' => get_request('user_password', ''), - 'cnf' => $ldap_cnf - )); + $ldap = new CLdap($ldap_cnf); + $ldap->connect(); + $result = $ldap->checkPass(get_request('user', $USER_DETAILS['alias']), get_request('user_password', '')); + if (!$result) + error(_('Login name or password is incorrect'));{ + } show_messages($result, _('LDAP login successful'), _('LDAP login was not successful')); } } Index: frontends/php/api/classes/CUser.php =================================================================== --- frontends/php/api/classes/CUser.php (revision 32376) +++ frontends/php/api/classes/CUser.php (revision 32393) @@ -822,15 +822,12 @@ // ****************************************************************************** // LOGIN Methods // ****************************************************************************** - public function ldapLogin($user) { - $cnf = isset($user['cnf']) ? $user['cnf'] : null; - - if (is_null($cnf)) { - $config = select_config(); - foreach ($config as $id => $value) { - if (zbx_strpos($id, 'ldap_') !== false) { - $cnf[str_replace('ldap_', '', $id)] = $config[$id]; - } + protected function ldapLogin($user) { + $config = select_config(); + $cnf = array(); + foreach ($config as $id => $value) { + if (zbx_strpos($id, 'ldap_') !== false) { + $cnf[str_replace('ldap_', '', $id)] = $config[$id]; } }