Back

How to hide login form after failed login attempts?


rafapaulino posted 5 days ago

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.


Sign in to participate in this thread!



We'd like to thank these amazing companies for supporting us