Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Commit

Permalink
Merge branch 'master' of git://github.com/zendframework/zf2 into zf11884
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard Kellner committed Nov 19, 2011
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
16 changes: 6 additions & 10 deletions src/Adapter/DbTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -371,18 +371,14 @@ public function authenticate()
return $authResult;
}

if (true === $this->getAmbiguityIdentity()) {
$validIdentities = array ();
$zendAuthCredentialMatchColumn = $this->_zendDb->foldCase('zend_auth_credential_match');
foreach ($resultIdentities as $identity) {
if (1 === (int) $identity[$zendAuthCredentialMatchColumn]) {
$validIdentities[] = $identity;
}
// At this point, ambiguity is allready done. Loop, check and break on success.
foreach ($resultIdentities as $identity) {
$authResult = $this->_authenticateValidateResult($identity);
if ($authResult->isValid()) {
break;
}
$resultIdentities = $validIdentities;
}

$authResult = $this->_authenticateValidateResult(array_shift($resultIdentities));

return $authResult;
}

Expand Down
4 changes: 2 additions & 2 deletions test/Adapter/DbTableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -426,8 +426,8 @@ public function testEqualUsernamesDifferentPasswordShouldAuthenticateWhenFlagIsS
$result2 = $this->_adapter->authenticate();
$this->assertFalse(in_array('More than one record matches the supplied identity.',
$result->getMessages()));
$this->assertTrue($result->isValid());
$this->assertEquals('my_username', $result->getIdentity());
$this->assertTrue($result2->isValid());
$this->assertEquals('my_username', $result2->getIdentity());
}


Expand Down

0 comments on commit 11732fe

Please sign in to comment.