authenticate(); Session::regenerate(); $this->redirectIntended(route('home.index')); } public function authenticate(): void { $this->validate(); $this->ensureIsNotRateLimited(); if (! Auth::attempt($this->only('email', 'password'), $this->remember)) { RateLimiter::hit($this->throttleKey()); throw ValidationException::withMessages([ 'email' => __('auth.failed'), ]); } RateLimiter::clear($this->throttleKey()); } protected function ensureIsNotRateLimited(): void { if (! RateLimiter::tooManyAttempts($this->throttleKey(), 5)) { return; } event(new Lockout(request())); $seconds = RateLimiter::availableIn($this->throttleKey()); throw ValidationException::withMessages([ 'email' => trans('auth.throttle', [ 'seconds' => $seconds, 'minutes' => ceil($seconds / 60), ]), ]); } protected function throttleKey(): string { return Str::transliterate(Str::lower($this->email).'|'.request()->ip()); } }