diff --git a/src/Http/Livewire/Auth/Login.php b/src/Http/Livewire/Auth/Login.php index a494190..c80ccb7 100644 --- a/src/Http/Livewire/Auth/Login.php +++ b/src/Http/Livewire/Auth/Login.php @@ -102,12 +102,11 @@ public function loginWithFortify(): LoginResponse | Redirector | null $request = request()->merge($data); - if (! Filament::auth()->attempt($this->getCredentialsFromFormData($data), $data['remember'] ?? false)) { + if (! $this->validateCredentials($this->getCredentialsFromFormData($data))) { $this->throwFailureValidationException(); } return $this->loginPipeline($request)->then(function (Request $request) use ($data) { - if (! Filament::auth()->attempt($this->getCredentialsFromFormData($data), $data['remember'] ?? false)) { $this->throwFailureValidationException(); } @@ -177,4 +176,13 @@ protected function getAuthenticateFormAction(): Action ->label(__('filament-panels::pages/auth/login.form.actions.authenticate.label')) ->submit('authenticate'); } + + /** @param array $credentials */ + protected function validateCredentials(array $credentials): bool + { + $provider = Filament::auth()->getProvider(); + $user = $provider->retrieveByCredentials($credentials); + + return $user && $provider->validateCredentials($user, $credentials); + } }