auto-session-timeout-warning 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
@@ -27,7 +27,7 @@ module AutoSessionTimeoutWarning
|
|
27
27
|
|
28
28
|
def render_session_status
|
29
29
|
response.headers["Etag"] = "" # clear etags to prevent caching
|
30
|
-
render
|
30
|
+
render json: {live: !!current_user, timeout: session[:auto_session_expires_at]}
|
31
31
|
end
|
32
32
|
|
33
33
|
def render_session_timeout
|
@@ -32,9 +32,11 @@ if(typeof(jQuery) != 'undefined'){
|
|
32
32
|
$.ajax({
|
33
33
|
url: '/active',
|
34
34
|
success: function(data) {
|
35
|
-
if(data
|
35
|
+
if(new Date(data.timeout).getTime() < (new Date().getTime() + #{warning} * 1000)){
|
36
36
|
showDialog();
|
37
|
-
|
37
|
+
}
|
38
|
+
if(data.live == false){
|
39
|
+
window.location.href = '/timeout';
|
38
40
|
}
|
39
41
|
}
|
40
42
|
});
|
@@ -45,10 +47,6 @@ if(typeof(jQuery) != 'undefined'){
|
|
45
47
|
function showDialog(){
|
46
48
|
$('.logout_dialog').trigger('click');
|
47
49
|
}
|
48
|
-
|
49
|
-
function doTimeout(){
|
50
|
-
window.location.href = '/timeout';
|
51
|
-
}
|
52
50
|
}
|
53
51
|
JS
|
54
52
|
javascript_tag(code)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: auto-session-timeout-warning
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-08-
|
12
|
+
date: 2013-08-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|