Alternatively, instead of using authenticateUsing (which does not handle throttle, 2fa etc.) you can customize Fortify login pipeline as below:
https://jetstream.laravel.com/2.x/features/authentication.html#customizing-the-authentication-pipeline
// JetstreamServiceProvider.php
use App\Actions\DoSomeThingMore;
use Illuminate\Http\Request;
use Laravel\Fortify\Actions\AttemptToAuthenticate;
use Laravel\Fortify\Actions\EnsureLoginIsNotThrottled;
use Laravel\Fortify\Actions\PrepareAuthenticatedSession;
use Laravel\Fortify\Actions\RedirectIfTwoFactorAuthenticatable;
use Laravel\Fortify\Fortify;
// ...
public function boot()
{
// ...
Fortify::authenticateThrough(function (Request $request) {
return array_filter([
config('fortify.limiters.login') ? null : EnsureLoginIsNotThrottled::class,
RedirectIfTwoFactorAuthenticatable::class,
AttemptToAuthenticate::class,
PrepareAuthenticatedSession::class,
DoSomeThingMore::class
]);
});
}
And, the DoSomeThingMore class could have something like this:
<?php
namespace App\Actions;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
class DoSomeThingMore
{
/**
* Do Something Here the incoming request.
*
* @param \Illuminate\Http\Request $request
* @param callable $next
* @return callable $next
*/
public function __invoke(Request $request, $next)
{
$request->session()->forget('coupon_applied');
Log::info(auth()->user());
return $next($request);
}
}