diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php
index 14d126ba31f6..616b26302ab4 100644
--- a/app/Http/Controllers/HomeController.php
+++ b/app/Http/Controllers/HomeController.php
@@ -1,7 +1,6 @@
env('SESSION_LIFETIME', 1),
+ 'lifetime' => env('SESSION_LIFETIME', 120),
'expire_on_close' => false,
diff --git a/resources/lang/en/texts.php b/resources/lang/en/texts.php
index 43e63e02d11f..5d0c49a94fe5 100644
--- a/resources/lang/en/texts.php
+++ b/resources/lang/en/texts.php
@@ -791,5 +791,7 @@ return array(
'referral_code' => 'Referral Code',
'last_sent_on' => 'Last sent on :date',
+ 'page_expire' => 'This page will expire soon, :click_here to keep working',
+
);
diff --git a/resources/views/header.blade.php b/resources/views/header.blade.php
index 7bf2c20f0212..2b41dc21431d 100644
--- a/resources/views/header.blade.php
+++ b/resources/views/header.blade.php
@@ -236,20 +236,37 @@
}
+ var redirectTimer = null;
+ function startWarnSessionTimeout() {
+ var oneMinute = 1000 * 60;
+ var twoMinutes = oneMinute * 2;
+ var twoHours = oneMinute * 120;
+ setTimeout(function() {
+ warnSessionExpring();
+ }, (twoHours - twoMinutes));
+ }
+
+ function warnSessionExpring() {
+ $("#keepAliveDiv").fadeIn();
+ redirectTimer = setTimeout(function() {
+ NINJA.formIsChanged = false;
+ window.location = '{{ URL::to('/dashboard') }}';
+ }, 1000 * 60);
+ }
+
// keep the token cookie valid to prevent token mismatch errors
function keepAlive() {
- window.setTimeout(function() {
- $.get('{{ URL::to('/keep_alive') }}', function(data) {
- keepAlive();
- })
- }, 1000 * 60 * 60);
- }
+ clearTimeout(redirectTimer);
+ $('#keepAliveDiv').fadeOut();
+ $.get('{{ URL::to('/keep_alive') }}');
+ startWarnSessionTimeout();
+ }
- $(function() {
- keepAlive();
+ $(function() {
+ startWarnSessionTimeout();
window.setTimeout(function() {
- $(".alert-hide").fadeOut(500);
+ $(".alert-hide").fadeOut();
}, 3000);
$('#search').blur(function(){
@@ -483,6 +500,10 @@