email = trim($this->email); $this->validate( ['email' => ['required', 'string', 'email'], 'password' => ['required', 'string']], [ 'email.required' => __('auth.email_required'), 'email.email' => __('auth.email_invalid'), 'password.required' => __('auth.password_required'), ], ); $email = Str::lower(trim($this->email)); $throttleKey = Str::transliterate($email.'|'.request()->ip()); $ipThrottleKey = 'login-ip|'.request()->ip(); foreach ([$throttleKey => 5, $ipThrottleKey => 20] as $key => $maxAttempts) { if (RateLimiter::tooManyAttempts($key, $maxAttempts)) { throw ValidationException::withMessages([ 'email' => __('auth.throttle', ['seconds' => RateLimiter::availableIn($key)]), ]); } } $signedIn = Auth::attemptWhen( ['email' => $email, 'password' => $this->password], fn ($user): bool => $checkLoginAllowed->execute($user->getAuthIdentifier()), $remember, ); if (! $signedIn) { RateLimiter::hit($throttleKey); RateLimiter::hit($ipThrottleKey); $this->reset('password'); // One message for a wrong password and a disabled account, so the // form never confirms that a disabled account's password is right. throw ValidationException::withMessages(['email' => __('auth.failed')]); } RateLimiter::clear($throttleKey); session()->regenerate(); } }