fix(user_ldap): Early failure for empty password login attempt

This avoids user_ldap logging about an invalid configuration with an
 empty password when the empty password actually comes from a login
 attempt.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
pull/44042/head
Côme Chilliet 3 months ago
parent 75c489cc4b
commit 2874dff773
No known key found for this signature in database
GPG Key ID: A3E2F658B28C760A

@ -1593,17 +1593,15 @@ class Access extends LDAPUtility {
return $filter;
}
/**
* @param string $name
* @param string $password
* @return bool
*/
public function areCredentialsValid($name, $password) {
public function areCredentialsValid(string $name, string $password): bool {
if ($name === '' || $password === '') {
return false;
}
$name = $this->helper->DNasBaseParameter($name);
$testConnection = clone $this->connection;
$credentials = [
'ldapAgentName' => $name,
'ldapAgentPassword' => $password
'ldapAgentPassword' => $password,
];
if (!$testConnection->setConfiguration($credentials)) {
return false;

Loading…
Cancel
Save