Fix exception when the password of a valid ldap user is invalid

This commit is contained in:
Johannes Meyer 2014-01-29 10:41:17 +01:00
parent 8e645d0410
commit 0b28bd31e5

View File

@ -159,15 +159,12 @@ class LdapUserBackend implements UserBackend
*/ */
public function authenticate(Credential $credentials) public function authenticate(Credential $credentials)
{ {
if (!$this->connection->testCredentials( if ($this->connection->testCredentials(
$this->connection->fetchDN($this->selectUsername($credentials->getUsername())), $this->connection->fetchDN($this->selectUsername($credentials->getUsername())),
$credentials->getPassword() $credentials->getPassword()
)) { )) {
return false; return new User($credentials->getUsername());
} }
$user = new User($credentials->getUsername());
return $user;
} }
/** /**