From 4436662a1ee19fc5e9eb76a0651d0de1aedb3ee2 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Fri, 14 Feb 2020 08:28:41 -0600 Subject: [PATCH] fix password check --- src/Illuminate/Auth/EloquentUserProvider.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/Auth/EloquentUserProvider.php b/src/Illuminate/Auth/EloquentUserProvider.php index e3c40e6b35b4..5fdf8a1eb55a 100755 --- a/src/Illuminate/Auth/EloquentUserProvider.php +++ b/src/Illuminate/Auth/EloquentUserProvider.php @@ -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; } @@ -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. *