ItzMe488
ItzMe488

Reputation: 191

Laravel Authentification

I used the Auth-code that allready is the laravel application. It works fine besides one mistake I wasn't able to find. I created a '/home' route in my routes.php. After some time I removed that route because I didn't needed her anymore.

Now I've got the problem that my website confuse me at every login / logout / register. The first site is the login script. Let's imagine I don't have a account in my DB. So I'm creating a new account. After the register formular I get directed to my ( not in my routes.php existing /home route ).

After that I'm logging out my account and try the login script. Sometimes I'm getting directed to my blog ( how it should be ). But sometimes it's just directing me to the ( still not existing ) /home route. And I really don't know why.. In my routes.php isn't any /home route. I looked into the AuthController / PasswordController and in all files at the Middleware dictionary and haven't found a single view return/redirect to any route called /home.

Does somebody know why I also can search to find the part of the code that directs me to the /home route?

Route::get('/', function(){
    if(Auth::guest())
        return Redirect::to('auth/login');
    else
        return view('test/index');
    });

// Authentication routes...
Route::get('auth/login', 'Auth\AuthController@getLogin');
Route::post('auth/login', 'Auth\AuthController@postLogin');
Route::get('auth/logout', 'Auth\AuthController@getLogout');

// Registration routes...
Route::get('auth/register', 'Auth\AuthController@getRegister');
Route::post('auth/register', 'Auth\AuthController@postRegister');

Upvotes: 1

Views: 67

Answers (1)

Alexey Mezenin
Alexey Mezenin

Reputation: 163748

The problem is Laravel 5 is automatically redirect you to /home by default.

Look at AuthController.php and change to this:

protected $redirectTo = '/';

Also, as alternative, you could create some route redirection.

Upvotes: 1

Related Questions