Skip to content

Commit

Permalink
fix password check
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Feb 14, 2020
1 parent afcfcf2 commit 4436662
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/Illuminate/Auth/EloquentUserProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public function retrieveByCredentials(array $credentials)
{
if (empty($credentials) ||
(count($credentials) === 1 &&
array_key_exists('password', $credentials))) {
Str::contains($this->firstCredentialKey($credentials), 'password'))) {
return;
}

Expand All @@ -131,6 +131,19 @@ public function retrieveByCredentials(array $credentials)
return $query->first();
}

/**
* Get the first key from the credential array.
*
* @param array $credentials
* @return string|null
*/
protected function firstCredentialKey(array $credentials)
{
foreach ($credentials as $key => $value) {
return $key;
}
}

/**
* Validate a user against the given credentials.
*
Expand Down

0 comments on commit 4436662

Please sign in to comment.