From 060e6ef21c7c34dc22cfbed378e78a3b18f9641e Mon Sep 17 00:00:00 2001 From: Andrew Date: Wed, 12 Mar 2014 16:34:17 -0700 Subject: [PATCH] Fix the check for creds vs ident columns This prevents the breaking change that was implemented with #220 --- src/Zizaco/Confide/ConfideEloquentRepository.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/Zizaco/Confide/ConfideEloquentRepository.php b/src/Zizaco/Confide/ConfideEloquentRepository.php index 982b43c..e732fb2 100644 --- a/src/Zizaco/Confide/ConfideEloquentRepository.php +++ b/src/Zizaco/Confide/ConfideEloquentRepository.php @@ -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]); @@ -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(); }