Skip to content

Commit 060e6ef

Browse files
committed
Fix the check for creds vs ident columns
This prevents the breaking change that was implemented with #220
1 parent ae50ba7 commit 060e6ef

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/Zizaco/Confide/ConfideEloquentRepository.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,14 @@ public function getUserByIdentity( $credentials, $identityColumns = array('email
108108
$user = $this->model();
109109

110110
$first = true;
111+
$hasWhere = false;
112+
111113
foreach ($identityColumns as $attribute) {
112114

113115
if(isset($credentials[$attribute]))
114116
{
117+
$hasWhere = true;
118+
115119
if($first)
116120
{
117121
$user = $user->where($attribute, $credentials[$attribute]);
@@ -124,12 +128,15 @@ public function getUserByIdentity( $credentials, $identityColumns = array('email
124128
}
125129
else
126130
{
127-
return null;
131+
continue;
128132
}
129133
}
130134

131-
$user = $user->get();
132-
135+
if($hasWhere)
136+
{
137+
$user = $user->get();
138+
}
139+
133140
if(! empty($user)) {
134141
return $user->first();
135142
}

0 commit comments

Comments
 (0)