{
/** Do we need to switch the user? */
if ($guid !== $this->_guid) {
- $this->_handleError(
- $this->_conn->getRead()->bind($guid, $pass),
- Horde_Kolab_Server_Exception::BIND_FAILED
- );
+ try {
+ $this->_conn->getRead()->bind($guid, $pass);
+ } catch (Horde_Ldap_Exception $e) {
+ if ($e->getCode() == 49) {
+ throw new Horde_Kolab_Server_Exception_Bindfailed(
+ 'Invalid username/password!',
+ Horde_Kolab_Server_Exception::BIND_FAILED,
+ $e
+ );
+ } else {
+ throw new Horde_Kolab_Server_Exception(
+ 'Bind failed!',
+ Horde_Kolab_Server_Exception::BIND_FAILED,
+ $e
+ );
+ }
+ }
$this->_guid = $guid;
}
}
{
$this->ldap_read->expects($this->exactly(1))
->method('bind')
- ->will($this->returnValue(new PEAR_Error('Bind failed!')));
+ ->will($this->throwException(new Horde_Ldap_Exception('Bind failed!')));
try {
$this->server->connectGuid('test', 'test');
$this->fail('No exception!');
{
$this->ldap_read->expects($this->exactly(1))
->method('bind')
- ->will($this->returnValue(new PEAR_Error('Credentials invalid!', 49)));
+ ->will($this->throwException(new Horde_Ldap_Exception('Credentials invalid!', 49)));
try {
$this->server->connectGuid('test', 'test');
$this->fail('No exception!');
} catch (Horde_Kolab_Server_Exception_Bindfailed $e) {
- $this->assertEquals('Credentials invalid!', $e->getMessage());
+ $this->assertEquals('Invalid username/password!', $e->getMessage());
}
}