Skip to content

Commit 4fd06db

Browse files
committed
Merge pull request #219 from AfzalivE/master
Check for empty identity_columns after array_diff. Thanks @AfzalivE
2 parents 3c74dbd + f145dee commit 4fd06db

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/Zizaco/Confide/Confide.php

+4
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ public function logAttempt( $credentials, $confirmed_only = false, $identity_col
9393
array_keys($credentials),
9494
array('password','remember')
9595
);
96+
// Recheck if identity_columns are populated now
97+
if (empty($identity_columns)) {
98+
return false;
99+
}
96100
}
97101

98102
// Check for throttle limit then log-in

tests/ConfideTest.php

+7
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,13 @@ public function testShouldLogAttempt()
114114
$this->assertTrue(
115115
$this->confide->logAttempt( $credentials, true )
116116
);
117+
118+
unset($credentials['username']);
119+
unset($credentials['email']);
120+
// Should not login because there is no username or email provided
121+
$this->assertFalse(
122+
$this->confide->logAttempt( $credentials, true )
123+
);
117124
}
118125

119126
public function testShouldThrottleLogAttempt()

0 commit comments

Comments
 (0)