auto-session-timeout 0.9.2 → 0.9.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- MzgzYWM4ODdjNTcwYWI5MmMxZDA0ZDc3NjBjYzRlNmJiN2Q4ZDk3OQ==
5
- data.tar.gz: !binary |-
6
- ZTU4MzEyZDc4OTE4YmVmZWM2NmUwY2EwYTI2YjcxZjU1NzRiZDM4NA==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- MmFiZGY1NjI4M2M2ZTUzNTZlNmM3OTY5ZjBjM2QyNjA2ZDZkZjE0ODIyYzg1
10
- MDhhZjQ1MmE4Y2RmMTYxNzQwMDMxZWI1NzhjYmYzMmZiNTYyZjI0M2NiNWFi
11
- MDdjZmUzMTlmOTliODc3OTAxNTExOTdjYTExOTY0ODk2ZTcyYTU=
12
- data.tar.gz: !binary |-
13
- ZGZkMjVmNjA5ZjU0YjYxMmJhMjZhYTI3ZTU4YjZlYzRhZjQ5YTNlODkzNmY4
14
- NjQyZmM4YzI5Mjk3MmIxOGMxYWU1NmI1NDc3OWFiZjJmZWMwNGI4ZjA4NDI0
15
- NDZlNGJjZDQ5NmFjNThmM2RkZDg5ZmU5NzBkOGVmZGRhNmMyYzg=
2
+ SHA1:
3
+ metadata.gz: ceab7b469f1cc6c0c87fedf3e5262885138db8b3
4
+ data.tar.gz: 569595f33aa3b87e5c8673870e96f9e65b449887
5
+ SHA512:
6
+ metadata.gz: e1d460ca59ba902da3e3498d947fbde81260fe78b741f28366ee36b99aa1c5c863b0b38103c478c92c91c405826d55232128126350c7252b5e4e810f49917c76
7
+ data.tar.gz: 3fea136e0b31699e01f06dac26650ed3af06ff1b191bd0ee3341c95b2cc5a0c2fbc778139e096ed114eb07e9e397c729fd3ec953557d53394405dc73f6f4eb5e
data/CHANGELOG CHANGED
@@ -1,3 +1,5 @@
1
- 6/22/13 - Switched to Bundler for generating the gemspec [Matthew Bass]
1
+ 2014-07-14 - Added jQuery support [krishnasrihari]
2
2
 
3
- 4/22/09 - Initial import [Matthew Bass]
3
+ 2013-06-22 - Switched to Bundler for generating the gemspec [pelargir]
4
+
5
+ 2009-04-22 - Initial import [pelargir]
@@ -1,7 +1,7 @@
1
1
  module Auto
2
2
  module Session
3
3
  module Timeout
4
- VERSION = "0.9.2"
4
+ VERSION = "0.9.3"
5
5
  end
6
6
  end
7
7
  end
@@ -2,7 +2,6 @@ module AutoSessionTimeout
2
2
 
3
3
  def self.included(controller)
4
4
  controller.extend ClassMethods
5
- controller.hide_action :render_auto_session_timeout
6
5
  end
7
6
 
8
7
  module ClassMethods
@@ -11,7 +10,7 @@ module AutoSessionTimeout
11
10
  if c.session[:auto_session_expires_at] && c.session[:auto_session_expires_at] < Time.now
12
11
  c.send :reset_session
13
12
  else
14
- unless c.url_for(c.params).start_with?(c.send(:active_url))
13
+ unless c.request.original_url.start_with?(c.send(:active_url))
15
14
  offset = seconds || (current_user.respond_to?(:auto_timeout) ? current_user.auto_timeout : nil)
16
15
  c.session[:auto_session_expires_at] = Time.now + offset if offset && offset > 0
17
16
  end
@@ -1,13 +1,27 @@
1
1
  module AutoSessionTimeoutHelper
2
2
  def auto_session_timeout_js(options={})
3
3
  frequency = options[:frequency] || 60
4
+ verbosity = options[:verbosity] || 2
4
5
  code = <<JS
5
6
  if (typeof(Ajax) != 'undefined') {
6
7
  new Ajax.PeriodicalUpdater('', '/active', {frequency:#{frequency}, method:'get', onSuccess: function(e) {
7
8
  if (e.responseText == 'false') window.location.href = '/timeout';
8
9
  }});
10
+ }else if(typeof(jQuery) != 'undefined'){
11
+ function PeriodicalQuery() {
12
+ $.ajax({
13
+ url: '/active',
14
+ success: function(data) {
15
+ if(data == 'false'){
16
+ window.location.href = '/timeout';
17
+ }
18
+ }
19
+ });
20
+ setTimeout(PeriodicalQuery, (#{frequency} * 1000));
21
+ }
22
+ setTimeout(PeriodicalQuery, (#{frequency} * 1000));
9
23
  } else {
10
- $.PeriodicalUpdater('/active', {minTimeout:#{frequency * 1000}, multiplier:0, method:'get', verbose:2}, function(remoteData, success) {
24
+ $.PeriodicalUpdater('/active', {minTimeout:#{frequency * 1000}, multiplier:0, method:'get', verbose:#{verbosity}}, function(remoteData, success) {
11
25
  if (success == 'success' && remoteData == 'false')
12
26
  window.location.href = '/timeout';
13
27
  });
@@ -12,6 +12,19 @@ if (typeof(Ajax) != 'undefined') {
12
12
  new Ajax.PeriodicalUpdater('', '/active', {frequency:60, method:'get', onSuccess: function(e) {
13
13
  if (e.responseText == 'false') window.location.href = '/timeout';
14
14
  }});
15
+ }else if(typeof(jQuery) != 'undefined'){
16
+ function PeriodicalQuery() {
17
+ $.ajax({
18
+ url: '/active',
19
+ success: function(data) {
20
+ if(data == 'false'){
21
+ window.location.href = '/timeout';
22
+ }
23
+ }
24
+ });
25
+ setTimeout(PeriodicalQuery, (60 * 1000));
26
+ }
27
+ setTimeout(PeriodicalQuery, (60 * 1000));
15
28
  } else {
16
29
  $.PeriodicalUpdater('/active', {minTimeout:60000, multiplier:0, method:'get', verbose:2}, function(remoteData, success) {
17
30
  if (success == 'success' && remoteData == 'false')
metadata CHANGED
@@ -1,69 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: auto-session-timeout
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.2
4
+ version: 0.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Bass
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-24 00:00:00.000000000 Z
11
+ date: 2017-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.3'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ! '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ! '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: minitest
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '4.2'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '4.2'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: actionpack
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '3.2'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '3.2'
69
69
  description: Provides automatic session timeout in a Rails application.
@@ -73,7 +73,7 @@ executables: []
73
73
  extensions: []
74
74
  extra_rdoc_files: []
75
75
  files:
76
- - .gitignore
76
+ - ".gitignore"
77
77
  - CHANGELOG
78
78
  - Gemfile
79
79
  - LICENSE.txt
@@ -98,17 +98,17 @@ require_paths:
98
98
  - lib
99
99
  required_ruby_version: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ! '>='
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  required_rubygems_version: !ruby/object:Gem::Requirement
105
105
  requirements:
106
- - - ! '>='
106
+ - - ">="
107
107
  - !ruby/object:Gem::Version
108
108
  version: '0'
109
109
  requirements: []
110
110
  rubyforge_project:
111
- rubygems_version: 2.0.3
111
+ rubygems_version: 2.6.10
112
112
  signing_key:
113
113
  specification_version: 4
114
114
  summary: Provides automatic session timeout in a Rails application.