rails-automaticlogout 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +7 -1
- data/app/assets/javascripts/automatic_logout.js +5 -5
- data/lib/rails/automaticlogout/version.rb +1 -1
- data/rails-automaticlogout.gemspec +1 -0
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d6b3a146fbaf9ece4dbe08f80adea0dab8dfe61
|
4
|
+
data.tar.gz: 1b05682f106f64a2891242e3629bdaed02037554
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7461b5d9189a3ce7e4f8130ae57a2d683a1d23e92b0c408f78d4b4267607b86ef0689afb8afb73d9407a10cf288c03e025d21cbfe6526dd90d52d52249c930bf
|
7
|
+
data.tar.gz: f40ca58f174fb995140f2467292cc99e9093e2a8f3023a6a86944d2a9a043c81bf07cb25e21baa31455222f467c8e3f62be9e9ee1399a4c0b4b3de2065baef80
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -14,7 +14,7 @@ Provides automatic session timeout in a Rails application. Very easy to install
|
|
14
14
|
Rails Automatic Logout works only Rails 4. You can add it to your Gemfile with:
|
15
15
|
|
16
16
|
```ruby
|
17
|
-
gem 'rails-automaticlogout'
|
17
|
+
gem 'rails-automaticlogout', '~> 0.1'
|
18
18
|
```
|
19
19
|
|
20
20
|
Then run bundle install
|
@@ -59,6 +59,12 @@ class ApplicationController < ActionController::Base
|
|
59
59
|
end
|
60
60
|
```
|
61
61
|
|
62
|
+
### Configure Javascript
|
63
|
+
Add in your application.js this require
|
64
|
+
|
65
|
+
```javascript
|
66
|
+
//= require automatic_logout
|
67
|
+
```
|
62
68
|
### Configure View (OPTIONAL)
|
63
69
|
|
64
70
|
Use Helper in your view, for show regressive timer. Add this in your file application.html.erb
|
@@ -22,7 +22,7 @@ AutomaticLogout.destroySession = function(){
|
|
22
22
|
}
|
23
23
|
|
24
24
|
/**
|
25
|
-
* Method regressive time based in session auto expired at
|
25
|
+
* Method regressive time based in session auto expired at.
|
26
26
|
* @param {[type]} date_session [description]
|
27
27
|
* @return {[type]} [description]
|
28
28
|
*/
|
@@ -48,9 +48,9 @@ AutomaticLogout.regressiveTimer = function(){;
|
|
48
48
|
diff_in_seconds = (timeout_in_seconds - now_in_seconds).toFixed(0);
|
49
49
|
|
50
50
|
if (diff_in_seconds <= 0){
|
51
|
-
|
51
|
+
alertify.alert(data_message, function () {
|
52
52
|
AutomaticLogout.destroySession();
|
53
|
-
}
|
53
|
+
});
|
54
54
|
}else{
|
55
55
|
var seconds_float = (target_date - current_date) / 1000,
|
56
56
|
date_format = AutomaticLogout.parseDate(seconds_float);
|
@@ -129,9 +129,9 @@ AutomaticLogout.ajaxSessionTimeout = function(){
|
|
129
129
|
var now_time = (new Date().getTime());
|
130
130
|
|
131
131
|
if ((response_timeout < now_time) === true){
|
132
|
-
|
132
|
+
alertify.alert(data_message, function () {
|
133
133
|
window.location.href = '/destroy_automatic_logout';
|
134
|
-
}
|
134
|
+
});
|
135
135
|
}
|
136
136
|
}, (data.seconds / 2) * 1000) // utiliza o mesmo valor em seconds que a pessoa irá ficar logado
|
137
137
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-automaticlogout
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thadeu Esteves Jr
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.2'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: alertify-rails
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.2.0
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.2.0
|
55
69
|
description: Provides automatic session timeout in a Rails application.
|
56
70
|
email:
|
57
71
|
- tadeuu@gmail.com
|
@@ -94,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
94
108
|
version: '0'
|
95
109
|
requirements: []
|
96
110
|
rubyforge_project:
|
97
|
-
rubygems_version: 2.
|
111
|
+
rubygems_version: 2.5.1
|
98
112
|
signing_key:
|
99
113
|
specification_version: 4
|
100
114
|
summary: Provides automatic session timeout in a Rails application.
|