Skip to content
Advertisement

Laravel Auth Login Page Just Refreshes

I am using Laravel 5.4. I ran the make:auth command to scaffold out my auth controllers and views. I can register a new account without issue as it is showing up in my database. However when I try to login, the login page simply refreshes without any errors being thrown. In the login controller I have the redirect set to ‘/home’ but this isn’t happening. Any idea what could be causing this? I have a feeling this is because I made the required tweaks to allow users to login with a username rather than email. But I’m not sure what is causing my login not to work when everything else works fine.

Below is my login controller.

use AuthenticatesUsers;

/**
 * Where to redirect users after login.
 *
 * @var string
 */
protected $redirectTo = '/home';

/**
 * Create a new controller instance.
 *
 * @return void
 */
public function __construct()
{
    $this->middleware('guest', ['except' => 'logout']);
}


public function username()
{
    return 'username';
}

}

Advertisement

Answer

Do a quick check to see if the route is being handled.

You might have to add Auth::routes(); in your web.php

Resource: laravel 5.3 new Auth::routes()

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement