try to sign in with remember me
May 10, 2018
4
Level 26
Session loging out
Im using in my controllers code like below to show messages in views:
Session::flash('message', 'Success message...');
return Redirect::back();
The problem is that recently messages doesn`t appear. I found that the reason was that I commented out the below line in my app/Http/Kernel.php:
protected $middlewareGroups = [
'web' => [
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
//\Illuminate\Session\Middleware\AuthenticateSession::class, //<- THIS LINE
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
// \App\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
'api' => [
'throttle:60,1',
'bindings',
],
];
When I remove my comment, session messages start`s working again, but appears new problem: after reload page I am always logged out from application.
What can be the problem?
Here is my routes/web.php file:
<?php
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
//Authentication Routes
Route::get('/', 'Frontend\PageController@home')->name('login');
Route::post('/', 'Auth\LoginController@authenticate');
Route::post('wyloguj', 'Auth\LoginController@logout')->name('logout');
//Registration Routes
Route::get('rejestracja', 'Auth\RegisterController@showRegistrationForm')->name('register');
Route::post('rejestracja', 'Auth\RegisterController@register');
Route::get('rejestracja/potwierdz/{confirmationCode}', 'Auth\RegisterController@confirm');
//Password Reset Routes
Route::get('przypomnij-haslo', 'Auth\ForgotPasswordController@showLinkRequestForm')->name('password.request');
Route::post('password/email', 'Auth\ForgotPasswordController@sendResetLinkEmail')->name('password.email');
Route::get('przypomnij-haslo/{token}', 'Auth\ResetPasswordController@showResetForm')->name('password.reset');
Route::post('przypomnij-haslo', 'Auth\ResetPasswordController@reset');
//OAuth Routes
Route::get('auth/{driver}', ['as' => 'socialAuth', 'uses' => 'Auth\SocialController@redirectToProvider']);
Route::get('auth/{driver}/callback', ['as' => 'socialAuthCallback', 'uses' => 'Auth\SocialController@handleProviderCallback']);
//--- UNLOGGED ---
Route::group(['middleware' => ['web', 'isActive']], function () {
Route::get('wspolpraca-ze-sprzedawcami', 'Frontend\PageController@cooperationSellers');
Route::get('wspolpraca-z-wykonawcami', 'Frontend\PageController@cooperationContractors');
Route::get('s/{slug}', 'Frontend\PageController@show');
//TODO - odtad w dol przeniesc do powyzszej grupy- dla zalogowanych
// Route::get('edycja-danych', 'Frontend\InvestorController@edit');
// Route::post('edycja-danych', 'Frontend\InvestorController@update');
// Route::get('pliki/{investment}', 'Frontend\FileController@index');
// Route::post('pliki/{investment}/store', 'Frontend\FileController@store'); //store file
// Route::post('pliki/{investment}', 'Frontend\FileController@destroy'); //delete files
// Route::get('wiadomosci/{investment}', 'Frontend\MessageController@showLoginForm'); //TODO
//odebrane
//wyslane
//archiwalne
//wybrana wiadomosc
//TODO - odtad w gore przeniesc do powyzszej grupy- dla zalogowanych
});
//--- USER LOGGED IN ---
Route::group(['middleware' => ['web', 'auth', 'isActive']], function () {
Route::get('inwestycje/dodaj', 'Frontend\InvestmentController@create');
Route::get('inwestycje/{id}', 'Frontend\InvestmentController@edit');
Route::patch('inwestycje/{id}', 'Frontend\InvestmentController@update');
Route::delete('inwestycje/{id}', 'Frontend\InvestmentController@destroy');
Route::post('inwestycje', 'Frontend\InvestmentController@store');
Route::get('pliki/{id?}', 'Frontend\FileController@index');
Route::post('pliki', 'Frontend\FileController@store');
Route::get('pliki/pobierz/{id}', 'Frontend\FileController@download');
Route::post('pliki/usun', 'Frontend\FileController@destroy');
});
//--- ADMIN PANEL ---
Route::group(['middleware' => ['web', 'auth', 'mustBeAdmin', 'isActive'], 'prefix' => 'admin'], function () {
Route::resource('admins', 'Backend\AdminController');
Route::resource('templates', 'Backend\TemplateController');
Route::resource('materials', 'Backend\MaterialController');
Route::get('stages/json', 'Backend\StageController@json');
Route::resource('stages', 'Backend\StageController');
Route::get('investors/search', 'Backend\InvestorController@search');
Route::resource('investors', 'Backend\InvestorController');
Route::resource('pages', 'Backend\PageController');
Route::get('companies/search', 'Backend\CompanyController@search');
Route::resource('companies', 'Backend\CompanyController');
});
Route::get('/cc', function() {
$exitCode = Artisan::call('cache:clear');
dd('Wyczyszczono cache');
})->middleware('auth.basic');
Please or to participate in this conversation.