metova 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ODNjYWI1M2Y1YjlkYTY1N2E1MTBiN2IxNTE4MjA4NmQwY2MzY2JmNA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YzRiMTZjNjA0ZDI5YjdmNmE5NmIwN2UyZjdlN2NkZmNmY2NmNzVhOQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MTk2ZmNlNTBlMDBmMmEzZTcyNTQ4MTM0MGQ4ZDQwZmM5MTg0MDEwNjkzNTcy
|
10
|
+
Mzk2MjdhZGFlN2VmOTAxZDAyZjVhMDQ1M2VlMGQyODIyN2ZkMTAxYzBjYThj
|
11
|
+
YjdiZmE0NDA4M2ZiZDAwMWU5NWM5OWVmYTdhOTcxODEwMmNlYzA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZWI1ZDc3Mzk5ZWE4NGNkNmMwMGI2MDU5YmE3NzMyNzk0YTQ1YzdhMzFhMjBj
|
14
|
+
YzBiZjRkZmEzZmVhODI2MzhhZjFiM2Q2ZmVjOTg3ZjJiZjE1NmRmZmI3OGNi
|
15
|
+
MjBjOWZjYmUyYTBhOTI2OTU5N2RlYzA2OTRhYmQzMjZiYzc5NGU=
|
@@ -10,14 +10,15 @@ module Devise
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def self.required_fields(klass)
|
13
|
-
[:authentication_token]
|
13
|
+
[:authentication_token, :token_expires_at]
|
14
14
|
end
|
15
15
|
|
16
16
|
def reset_authentication_token
|
17
17
|
self.authentication_token = loop do
|
18
|
-
token =
|
18
|
+
token = Devise.friendly_token
|
19
19
|
break token unless self.class.exists?(authentication_token: token)
|
20
20
|
end
|
21
|
+
self.token_expires_at = Time.current + expire_token_in
|
21
22
|
end
|
22
23
|
|
23
24
|
def reset_authentication_token!
|
@@ -26,9 +27,16 @@ module Devise
|
|
26
27
|
end
|
27
28
|
|
28
29
|
def ensure_authentication_token!
|
29
|
-
reset_authentication_token! if authentication_token.blank?
|
30
|
+
reset_authentication_token! if authentication_token.blank? || token_expired?
|
30
31
|
end
|
31
32
|
|
33
|
+
def token_expired?
|
34
|
+
token_expires_at.nil? || token_expires_at.past?
|
35
|
+
end
|
36
|
+
|
37
|
+
def expire_token_in
|
38
|
+
14.days
|
39
|
+
end
|
32
40
|
end
|
33
41
|
end
|
34
42
|
end
|
data/lib/metova/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metova
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Logan Serman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|