Skip to content

Commit

Permalink
Fix the check for creds vs ident columns
Browse files Browse the repository at this point in the history
This prevents the breaking change that was implemented with #220
  • Loading branch information
andrew13 committed Mar 12, 2014
1 parent ae50ba7 commit 060e6ef
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/Zizaco/Confide/ConfideEloquentRepository.php
Expand Up @@ -108,10 +108,14 @@ public function getUserByIdentity( $credentials, $identityColumns = array('email
$user = $this->model();

$first = true;
$hasWhere = false;

foreach ($identityColumns as $attribute) {

if(isset($credentials[$attribute]))
{
$hasWhere = true;

if($first)
{
$user = $user->where($attribute, $credentials[$attribute]);
Expand All @@ -124,12 +128,15 @@ public function getUserByIdentity( $credentials, $identityColumns = array('email
}
else
{
return null;
continue;
}
}

$user = $user->get();

if($hasWhere)
{
$user = $user->get();
}

if(! empty($user)) {
return $user->first();
}
Expand Down

0 comments on commit 060e6ef

Please sign in to comment.