mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 05:02:36 +01:00
Prevent session history from showing as blank
This commit is contained in:
parent
2a97fc5456
commit
02c300e9f9
@ -18,7 +18,6 @@ class Kernel extends HttpKernel {
|
||||
'App\Http\Middleware\VerifyCsrfToken',
|
||||
'App\Http\Middleware\DuplicateSubmissionCheck',
|
||||
'App\Http\Middleware\QueryLogging',
|
||||
'App\Http\Middleware\SessionDataCheckMiddleware',
|
||||
'App\Http\Middleware\StartupCheck',
|
||||
];
|
||||
|
||||
|
@ -1,31 +0,0 @@
|
||||
<?php namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Auth;
|
||||
use Session;
|
||||
|
||||
// https://arjunphp.com/laravel5-inactivity-idle-session-logout/
|
||||
class SessionDataCheckMiddleware {
|
||||
|
||||
/**
|
||||
* Check session data, if role is not valid logout the request
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
$bag = Session::getMetadataBag();
|
||||
$max = env('IDLE_TIMEOUT_MINUTES', 6 * 60) * 60; // minute to second conversion
|
||||
$elapsed = time() - $bag->getLastUsed();
|
||||
|
||||
if ( ! $bag || $elapsed > $max) {
|
||||
$request->session()->flush();
|
||||
Auth::logout();
|
||||
$request->session()->flash('warning', trans('texts.inactive_logout'));
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
@ -13,7 +13,7 @@ use Event;
|
||||
use Schema;
|
||||
use App\Models\Language;
|
||||
use App\Models\InvoiceDesign;
|
||||
use App\Events\UserSettingsChanged;
|
||||
use App\Events\UserLoggedIn;
|
||||
use App\Libraries\CurlUtils;
|
||||
|
||||
/**
|
||||
@ -118,7 +118,7 @@ class StartupCheck
|
||||
|
||||
// Make sure the account/user localization settings are in the session
|
||||
if (Auth::check() && !Session::has(SESSION_TIMEZONE)) {
|
||||
Event::fire(new UserSettingsChanged());
|
||||
Event::fire(new UserLoggedIn());
|
||||
}
|
||||
|
||||
// Check if the user is claiming a license (ie, additional invoices, white label, etc.)
|
||||
|
Loading…
Reference in New Issue
Block a user