mardi 17 octobre 2017

Laravel 5.3 - Authentication is broken

About a year ago we took over an existing Laravel 5.1 site and upgraded to 5.3 - We recently became aware that an admin panel that was part of the old site no longer works (or unable to authenticate).

The original routes file contains the following:

//Login
 Route::controllers([
     'auth' => 'Auth\AuthController',
     'password' => 'Auth\PasswordController',
 ]);
//Admin
//Dashboard
Route::group(array('prefix' => 'admin', 'middleware' => 'auth'), function() {

    //Dashboard
    Route::get('/webadmin', array('as' => 'dashboard', 'uses' => 'Admin\DashboardController@index'));

});

Which after the upgrade stopped working as I understand the Route::controllers method was depreciated. We changed it to the following as I understand that was the replacement:

//Login
Route::resource('password','Auth\PasswordController');
Route::resource('auth','Auth\LoginController');
//Admin
//Dashboard
Route::group(array('prefix' => 'admin', 'middleware' => 'auth'), function() {

    //Dashboard
    Route::get('/webadmin', array('as' => 'dashboard', 'uses' => 'Admin\DashboardController@index'));
});

However, when we access the sites admin panel by http://ift.tt/2yp8ycW we are automatically redirect to example.com/login which then displays the dreadful NotFoundHttpException in compiled.php

This leads me to believe that the authentication middleware is not registered correctly. I am not sure what the correctly route is to take so will gladly appreciate any assistance :)



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire