-
-
Save dangelion/aa7fc54ea75f7b2d6062fc79f07e04e8 to your computer and use it in GitHub Desktop.
Laravel: error “The page has expired due to inactivity” (419 unknown status)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
APP_NAME='My App Name' | |
APP_ENV=local | |
APP_KEY=base64:+P6N350yBjAzw4q3oarQY/8mpJxDY7uwTTafriWrvMM= | |
APP_DEBUG=true | |
APP_LOG_LEVEL=debug | |
APP_URL=https://app.my-domain.com | |
DB_CONNECTION=mysql | |
DB_HOST=localhost | |
DB_PORT=3306 | |
DB_DATABASE=xxx | |
DB_USERNAME=xxx | |
DB_PASSWORD=xxx | |
BROADCAST_DRIVER=log | |
CACHE_DRIVER=file | |
SESSION_DRIVER=file | |
SESSION_LIFETIME=1 | |
QUEUE_DRIVER=sync | |
REDIS_HOST=127.0.0.1 | |
REDIS_PASSWORD=null | |
REDIS_PORT=6379 | |
MAIL_DRIVER=smtp | |
MAIL_HOST=smtp.mailtrap.io | |
MAIL_PORT=2525 | |
MAIL_USERNAME=xxx | |
MAIL_PASSWORD=xxx | |
MAIL_ENCRYPTION=null | |
PUSHER_APP_ID= | |
PUSHER_APP_KEY= | |
PUSHER_APP_SECRET= | |
PUSHER_APP_CLUSTER=mt1 | |
ITEMS_PER_PAGE=20 | |
BIRTH_YEAR=2018 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Controllers; | |
use Illuminate\Http\Request; | |
use Auth; | |
class HomeController extends Controller | |
{ | |
/** | |
* Create a new controller instance. | |
* | |
* @return void | |
*/ | |
public function __construct() | |
{ | |
$this->middleware('auth'); | |
} | |
/** | |
* Show the application dashboard. | |
* | |
* @return \Illuminate\Http\Response | |
*/ | |
public function index() | |
{ | |
if(Auth::user()->hasRole('admin')) | |
{ | |
return redirect('/projects'); | |
} | |
elseif(Auth::user()->hasRole('referent')) | |
{ | |
return redirect('/activities'); | |
} | |
else | |
{ | |
return redirect('/profile'); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="{{ app()->getLocale() }}"> | |
<head> | |
@include('partials.head') | |
</head> | |
<body class="m--skin- m-header--fixed m-header--fixed-mobile m-aside-left--enabled m-aside-left--skin-dark m-aside-left--offcanvas m-footer--push m-aside--offcanvas-default"> | |
@yield('content') | |
@include('partials.before_body_end') | |
{{-- begin::Page Snippets --}} | |
<script src="{{ asset('dist/snippets/pages/user/login.js') }}" type="text/javascript"></script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@extends('layouts.login') | |
@section('content') | |
<div class="container-fluid h-100"> | |
<div class="row h-100"> | |
{{-- | |
Col 1: Form | |
--}} | |
<div class="col-lg-6 order-last2 order-lg-first2 login-col-form"> | |
<div class="row align-items-center justify-content-center text-center h-100"> | |
<div class="col login-col-form-inner"> | |
{{-- | |
//////////////////////////////////////// | |
Logo | |
//////////////////////////////////////// | |
--}} | |
<div class="m-login__logo mb-5"> | |
<img src="{{ asset('dist/app/media/img/logos/logo.png') }}" | |
class="login-logo"> | |
</div> | |
{{-- | |
//////////////////////////////////////// | |
Sign In | |
//////////////////////////////////////// | |
--}} | |
<div class="m-login__signin"> | |
<div class="m-login__head"> | |
<h4 class="m-login__title2 h4 mb-4"> | |
Accedi | |
</h4> | |
</div> | |
<form class="m-login__form m-form" method="POST" action="{{ route('login') }}"> | |
@csrf | |
@if ($errors->has('email')) | |
<div class="m-alert m-alert--outline- m-alert--outline-2x- alert alert-danger alert-dismissible- fade show" role="alert"> | |
{{-- <button type="button" class="close" data-dismiss="alert" aria-label="Close"></button> --}} | |
<strong>Ops!</strong> Error. | |
</div> | |
@endif | |
@if ($errors->has('password')) | |
<div class="m-alert m-alert--outline- m-alert--outline-2x- alert alert-danger alert-dismissible- fade show" role="alert"> | |
{{-- <button type="button" class="close" data-dismiss="alert" aria-label="Close"></button> --}} | |
<strong>Ops!</strong> Error. | |
{{-- {{ $errors->first('email') }} --}} | |
</div> | |
@endif | |
<div class="form-group m-form__group2 pb-0 {{ $errors->has('email') ? 'has-error' : '' }}"> | |
<input id="email" type="text" class="form-control form-control-lg m-input2" | |
placeholder="Email" name="email" value="{{ old('email') }}" | |
required autofocus autocomplete="off"> | |
</div> | |
<div class="form-group m-form__group2 {{ $errors->has('password') ? ' has-error' : '' }}"> | |
<input id="password" type="password" class="form-control form-control-lg m-input2 m-login__form-input--last2" | |
name="password" placeholder="Password" required> | |
</div> | |
<div class="row m-login__form-sub"> | |
<div class="col m--align-left"> | |
<label class="m-checkbox m-checkbox--focus"> | |
<input type="checkbox" name="remember" {{ old('remember') ? 'checked' : '' }}> | |
Remember me | |
<span></span> | |
</label> | |
</div> | |
<div class="col m--align-right"> | |
{{-- {{ route('password.request') }} --}} | |
{{-- <a href="javascript:;" id="m_login_forget_password" class="m-link"> | |
Forget password | |
</a> --}} | |
</div> | |
</div> | |
<div class="m-login__form-action mt-3"> | |
<button type="submit" id="m_login_signin_submit__cannc" | |
class="btn btn-lg btn-brand m-btn m-btn--pill m-btn--custom m-btn--air"> | |
Login | |
</button> | |
</div> | |
</form> | |
</div> | |
</div> | |
</div> | |
</div> {{-- Col 1 --}} | |
</div> | |
</div> | |
@endsection |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Controllers\Auth; | |
use Auth; | |
use Illuminate\Http\Request; | |
use App\Http\Controllers\Controller; | |
use Illuminate\Foundation\Auth\AuthenticatesUsers; | |
class LoginController extends Controller | |
{ | |
/* | |
|-------------------------------------------------------------------------- | |
| Login Controller | |
|-------------------------------------------------------------------------- | |
| | |
| This controller handles authenticating users for the application and | |
| redirecting them to your home screen. The controller uses a trait | |
| to conveniently provide its functionality to your applications. | |
| | |
*/ | |
use AuthenticatesUsers; | |
/** | |
* Where to redirect users after login. | |
* | |
* @var string | |
*/ | |
protected $redirectTo = '/'; | |
/** | |
* Create a new controller instance. | |
* | |
* @return void | |
*/ | |
public function __construct() | |
{ | |
$this->middleware('guest')->except('logout'); | |
} | |
/** | |
* Logout the authenticated user | |
*/ | |
public function logout(Request $request) { | |
Auth::logout(); | |
return redirect('/login'); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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! | |
| | |
*/ | |
// Route::get('/', function () { | |
// return view('welcome'); | |
// }); | |
/* | |
|-------------------------------------------------------------------------- | |
| Index | |
|-------------------------------------------------------------------------- | |
*/ | |
// Route::get('/', 'HomeController@index'); | |
Route::get('/', 'HomeController@index')->name('home'); | |
/* | |
|-------------------------------------------------------------------------- | |
| Authentication | |
|-------------------------------------------------------------------------- | |
*/ | |
Auth::routes(); | |
Route::get('logout', '\App\Http\Controllers\Auth\LoginController@logout'); | |
/* | |
| Authentication required for the next routes | |
*/ | |
Route::middleware(['auth'])->group(function(){ | |
/* | |
|-------------------------------------------------------------------------- | |
| User | |
|-------------------------------------------------------------------------- | |
*/ | |
Route::middleware(['role:admin,referent'])->group(function(){ | |
Route::get( | |
'/users', | |
'UsersController@index' | |
); | |
Route::get( | |
'/users/create', | |
'UsersController@create' | |
); | |
Route::post( | |
'/users', | |
'UsersController@store' | |
); | |
Route::get( | |
'/users/{userId}', | |
'UsersController@show' | |
); | |
}); | |
Route::middleware(['role:admin,referent','userEditable'])->group(function(){ | |
Route::get( | |
'/users/{userId}/edit', | |
'UsersController@edit' | |
); | |
Route::put( | |
'/users/{userId}/edit', | |
'UsersController@update' | |
); | |
Route::post( | |
'/users/{userId}/password', | |
'UsersController@resetPassword' | |
); | |
}); | |
Route::get( | |
'/profile', | |
'UsersController@profile' | |
); | |
// route for changing their own password | |
Route::get( | |
'/profile/password', | |
'UsersController@changePassword' | |
); | |
Route::post( | |
'/profile/password', | |
'UsersController@updatePassword' | |
); | |
// route for search, add and remove volunteer from referent | |
Route::post( | |
'/users/search', | |
'UsersController@searchVolunteer' | |
)->middleware(['role:admin,referent']); | |
Route::post( | |
'/users/{referentId}/user/{userId}/add', | |
'UsersController@addVolunteer' | |
)->middleware(['role:admin']); | |
Route::post( | |
'/users/{referentId}/user/{userId}/remove', | |
'UsersController@removeVolunteer' | |
)->middleware(['role:admin,referent','userEditable']); | |
/* | |
|-------------------------------------------------------------------------- | |
| Project | |
|-------------------------------------------------------------------------- | |
*/ | |
Route::middleware('role:admin,referent')->group(function(){ | |
Route::get( | |
'/projects', | |
'ProjectsController@index' | |
); | |
}); | |
Route::middleware(['role:admin'])->group(function(){ | |
Route::get( | |
'/projects/create', | |
'ProjectsController@create' | |
); | |
Route::post( | |
'/projects', | |
'ProjectsController@store' | |
); | |
Route::get( | |
'/projects/{projectId}/edit', | |
'ProjectsController@edit' | |
); | |
Route::put( | |
'/projects/{projectId}', | |
'ProjectsController@update' | |
); | |
}); | |
Route::middleware('role:admin,referent','projectViewable')->get( | |
'/projects/{projectId}', | |
'ProjectsController@show' | |
); | |
Route::middleware('role:admin,referent','projectUserEditable')->group(function(){ | |
Route::post( | |
'/projects/{projectId}/user/{volunteerId}/add', | |
'ProjectsController@addVolunteer' | |
); | |
Route::post( | |
'/projects/{projectId}/user/{volunteerId}/remove', | |
'ProjectsController@removeVolunteer' | |
); | |
}); | |
Route::post( | |
'/projects/user/search', | |
'ProjectsController@searchVolunteer' | |
)->middleware(['role:admin,referent']); | |
Route::post( | |
'/projects/{projectId}/users', | |
'ProjectsController@generateUsersList' | |
)->middleware(['role:admin,referent']); | |
/* | |
|-------------------------------------------------------------------------- | |
| Costs | |
|-------------------------------------------------------------------------- | |
*/ | |
Route::middleware('role:admin,referent')->group(function(){ | |
Route::get( | |
'/costs', | |
'CostsController@index' | |
); | |
Route::get( | |
'/costs/create', | |
'CostsController@create' | |
); | |
Route::post( | |
'/costs', | |
'CostsController@store' | |
); | |
}); | |
Route::middleware('role:admin,referent','costEditable')->group(function(){ | |
Route::get( | |
'/costs/{costId}/edit', | |
'CostsController@edit' | |
); | |
Route::put( | |
'/costs/{costId}', | |
'CostsController@update' | |
); | |
}); | |
/* | |
|-------------------------------------------------------------------------- | |
| Activity | |
|-------------------------------------------------------------------------- | |
*/ | |
Route::middleware(['role:admin,referent'])->get( | |
'/activities', | |
'ActivitiesController@index' | |
); | |
Route::middleware(['role:referent,volunteer','activeUser'])->group(function(){ | |
Route::get( | |
'activities/create', | |
'ActivitiesController@create' | |
); | |
Route::post( | |
'activities', | |
'ActivitiesController@store' | |
); | |
}); | |
Route::middleware(['role:admin,referent,volunteer','activeUser','activityEditable'])->group(function(){ | |
Route::get( | |
'/activities/{activityId}/edit', | |
'ActivitiesController@edit' | |
); | |
Route::put( | |
'/activities/{activityId}', | |
'ActivitiesController@update' | |
); | |
}); | |
Route::middleware(['role:referent,volunteer'])->get( | |
'/activities/my', | |
'ActivitiesController@indexMy' | |
); | |
// moderate activities | |
Route::middleware(['role:admin,referent','activityEditable'])->post( | |
'/activities/{activityId}/moderate', | |
'ActivitiesController@moderate' | |
); | |
/* | |
|-------------------------------------------------------------------------- | |
| Activity Type | |
|-------------------------------------------------------------------------- | |
*/ | |
Route::middleware(['role:admin'])->group(function(){ | |
Route::get( | |
'/activity_types', | |
'ActivityTypesController@index' | |
)->middleware(['role:admin,referent']); | |
Route::get( | |
'/activity_types/create', | |
'ActivityTypesController@create' | |
); | |
Route::post( | |
'/activity_types', | |
'ActivityTypesController@store' | |
); | |
Route::get( | |
'/activity_types/{activityTypeId}/edit', | |
'ActivityTypesController@edit' | |
); | |
Route::put( | |
'/activity_types/{activityTypeId}', | |
'ActivityTypesController@update' | |
); | |
}); | |
/* | |
|-------------------------------------------------------------------------- | |
| Exports | |
|-------------------------------------------------------------------------- | |
*/ | |
Route::get( | |
'/exports', | |
'ExportsController@index' | |
); | |
Route::post( | |
'/exports/download', | |
'ExportsController@exports' | |
); | |
/* | |
|-------------------------------------------------------------------------- | |
| Reports | |
|-------------------------------------------------------------------------- | |
*/ | |
Route::middleware(['role:admin,monitor'])->group(function(){ | |
Route::get( | |
'/reports', | |
'ReportsController@index' | |
); | |
Route::get( | |
'/reports/timesheet', | |
'ReportsController@timesheet' | |
); | |
Route::get( | |
'/reports/timesheet/download', | |
'ReportsController@timesheetDownload' | |
); | |
Route::get( | |
'/reports/hours/', | |
'ReportsController@activityTypesHours' | |
); | |
Route::get( | |
'/reports/expenses/', | |
'ReportsController@costCentresExpenses' | |
); | |
Route::get( | |
'/reports/reimbursement', | |
'ReportsController@reimbursement' | |
); | |
Route::get( | |
'/reports/reimbursement/download', | |
'ReportsController@reimbursementDownload' | |
); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment