4 months ago

How to hide login form after reaching the total of failed login attempts?

Posted 4 months ago by rafacorre

I want to hide the login form and display an error message instead, but I can't.

I tried to put the code below that rewrites the action on the controller that shows the form, but the method that checks for too many login attempts doesn't seem to work and never returns true.

public function showLoginForm(Request $request)
    if (method_exists($this, 'hasTooManyLoginAttempts') &&
        $this->hasTooManyLoginAttempts($request) ) {
            $seconds = $this->limiter()->availableIn($this->throttleKey($request));
            return view('auth.block', array(
                'seconds' => $seconds

    return view('auth.login');

I managed the authentication process with php artisan make: auth login controller is the default generated by Laravel, the only change is in the action that displays the form.

Please sign in or create an account to participate in this conversation.