By default Laravel shows throttling message "Too many login attempts" message below email/username field.
How to display this message at top of the page.
Override sendLockoutResponse
in your `LoginController
protected function sendLockoutResponse(Request $request)
{
$seconds = $this->limiter()->availableIn(
$this->throttleKey($request)
);
throw ValidationException::withMessages([
'throttle' => [Lang::get('auth.throttle', ['seconds' => $seconds])],
])->status(Response::HTTP_TOO_MANY_REQUESTS);
}
You need to import following
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Support\Facades\Lang;
use Illuminate\Validation\ValidationException;
Then in your view add the following where you need the throttled message
If your Laravel version is 5.8.12
or newer
@error('throttle')
<strong>{{ $message }}</strong>
@enderror
else
@if ($errors->has('throttle'))
<strong>{{ $errors->first('throttle') }}</strong>
@endif