Skip to content

Commit

Permalink
fix(user_ldap): Early failure for empty password login attempt
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
come-nc authored and backportbot[bot] committed Mar 7, 2024
1 parent d046bf6 commit c26685a
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions apps/user_ldap/lib/Access.php
Expand Up @@ -1593,17 +1593,15 @@ public function getFilterForUserCount(): string {
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;
Expand Down

0 comments on commit c26685a

Please sign in to comment.