diff --git a/app/Http/Controllers/Auth/AuthController.php b/app/Http/Controllers/Auth/AuthController.php index 10976a249997..c5fbccb78790 100644 --- a/app/Http/Controllers/Auth/AuthController.php +++ b/app/Http/Controllers/Auth/AuthController.php @@ -186,6 +186,10 @@ class AuthController extends Controller Session::flush(); + if ($reason = request()->reason) { + Session::flash('warning', trans("texts.{$reason}_logout")); + } + return $response; } } diff --git a/resources/lang/en/texts.php b/resources/lang/en/texts.php index 602bc6eb2cae..8ca03297ce5a 100644 --- a/resources/lang/en/texts.php +++ b/resources/lang/en/texts.php @@ -2344,6 +2344,8 @@ $LANG = array( 'view_statement' => 'View Statement', 'statement' => 'Statement', 'statement_date' => 'Statement Date', + 'inactivity_logout' => 'Due to inactivity, you have been automatically logged out.', + ); return $LANG; diff --git a/resources/views/header.blade.php b/resources/views/header.blade.php index 18d34b339f42..62576029dec1 100644 --- a/resources/views/header.blade.php +++ b/resources/views/header.blade.php @@ -225,6 +225,12 @@ } $(function() { + // auto-logout after 8 hours + window.setTimeout(function() { + window.location = '{{ URL::to('/logout?reason=inactivity') }}'; + }, 1000 * 60 * 60 * 8); + + // auto-hide status alerts window.setTimeout(function() { $(".alert-hide").fadeOut(); }, 3000);