Reputation: 803
I'm at a loss here... I'm using Laravel 8 with the jetstream inertia stack. I've setup event listeners in my EventServiceProvider
to log various authentication events but the events don't seem to fire as expected. Login
and Logout
both work as expected, but I can't figure out the logic behind Attempting
and Failed
. Attempting
only seems to fire when I successfully login. If I pass an invalid email/password it never fires. And I can't seem to figure out when Failed
ever fires. All I want to accomplish is logging attempts to login to my system, even if they are providing invalid credentials.
Here's my EventServiceProvider. All the listeners are very simple with just a line to log a message in the handle()
method.
protected $listen = [
\Illuminate\Auth\Events\Attempting::class => [
\App\Listeners\Auth\LogAttemptingLogin::class
],
\Illuminate\Auth\Events\Login::class => [
\App\Listeners\Auth\LogSuccessfulLogin::class,
],
\Illuminate\Auth\Events\Logout::class => [
\App\Listeners\Auth\LogSuccessfulLogout::class,
],
\Illuminate\Auth\Events\Failed::class => [
\App\Listeners\Auth\LogFailedLogin::class,
]
];
Upvotes: 2
Views: 2203
Reputation: 21
I'm experiencing the same issues with exact same stack. It feels like LogFailedLogin not triggering is a bug or something.
I opened an issue as I'm having an hunch that it has to do with Fortify: https://github.com/laravel/fortify/issues/145.
Edit: It's a confirmed bug at the time of writing.
Upvotes: 2