devise-token_authenticatable 0.4.10 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 18941e6181185c72c432e867d029915727854a34
4
- data.tar.gz: 366abb9cb6ae2830ee8c8adee619f075d81ee943
3
+ metadata.gz: c1039c8f938eaa6427775e5d99c572814548eb7e
4
+ data.tar.gz: ca880f38634ca2474ca156d8ca401a3376b9ade5
5
5
  SHA512:
6
- metadata.gz: 629be88bf004382d800360e5b08a795d318bf36b6f4870cafd51377d8a3ad350af6b08380973d2df9b87b792c1571682d084dcb0fafdf9a489e505e8bb95689f
7
- data.tar.gz: e798e6b774cbbc0efcc1d1bb75de078f28c3e49a25c471a05d27ecf409d6ec724f60aa70c60cb74deacdd355dca71b265259c1299cf0938308d93ace6d01fb41
6
+ metadata.gz: 4711fd8ffad1960a8009b350da88414c8f165cf786cd5c9f90316f67159df29e9a38390a5c15cea4601be39824bd36f90bc6f21900ca0cb48c849bdbfd13ce28
7
+ data.tar.gz: b22e38559109eed66592e44edd00a0d9b853790f1059575751e2ba441b9e72e9d23d9b20b76f80a6b43b402ae8ce478eeffa682c48944213992695b51462d40d
@@ -1,6 +1,5 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.0.0
4
3
  - 2.1.9
5
4
  - 2.2.5
6
5
  - 2.3.1
data/README.md CHANGED
@@ -29,6 +29,7 @@ Or install it yourself as:
29
29
  `~> 0.3` | `~> 3.4.0`
30
30
  `~> 0.4.0`, `< 0.4.9` | `~> 3.5.0`, `< 3.5.2`
31
31
  `~> 0.4.9` | `~> 3.5.2`
32
+ `~> 0.5.0` | `>= 4.0.0`, `< 4.2.0`
32
33
 
33
34
  ## Usage
34
35
 
@@ -47,7 +48,6 @@ This gem can be configured as shown in the following:
47
48
  ```ruby
48
49
  Devise::TokenAuthenticatable.setup do |config|
49
50
  # enables the expiration of a token after a specified amount of time,
50
- # requires an additional field on the model: `authentication_token_created_at`
51
51
  # defaults to nil
52
52
  config.token_expires_in = 1.day
53
53
 
@@ -22,9 +22,9 @@ Gem::Specification.new do |spec|
22
22
  spec.require_paths = ["lib"]
23
23
 
24
24
 
25
- spec.add_dependency "devise", ">= 3.5.2", "< 4.0.0"
25
+ spec.add_dependency "devise", ">= 4.0.0", "< 4.2.0"
26
26
 
27
- spec.add_development_dependency "rails", "~> 4.1"
27
+ spec.add_development_dependency "rails", "~> 4.2"
28
28
  spec.add_development_dependency "rspec-rails", "~> 3.0"
29
29
  spec.add_development_dependency "pry", "~> 0.10"
30
30
  spec.add_development_dependency "factory_girl_rails", "~> 4.4"
@@ -53,19 +53,13 @@ module Devise
53
53
  end
54
54
 
55
55
  def self.required_fields(klass)
56
- fields = [:authentication_token]
57
-
58
- unless Devise::TokenAuthenticatable.token_expires_in.blank?
59
- fields.push(:authentication_token_created_at)
60
- end
61
-
62
- fields
56
+ [:authentication_token, :authentication_token_created_at]
63
57
  end
64
58
 
65
59
  # Generate new authentication token (a.k.a. "single access token").
66
60
  def reset_authentication_token
67
61
  self.authentication_token = self.class.authentication_token
68
- self.authentication_token_created_at = Time.now unless token_expires_in.blank?
62
+ self.authentication_token_created_at = Time.now
69
63
  end
70
64
 
71
65
  # Generate new authentication token and save the record.
@@ -1,5 +1,5 @@
1
1
  module Devise
2
2
  module TokenAuthenticatable
3
- VERSION = '0.4.10'.freeze
3
+ VERSION = '0.5.0'.freeze
4
4
  end
5
5
  end
@@ -10,7 +10,7 @@ FactoryGirl.define do
10
10
  end
11
11
 
12
12
  after(:create) do |u, evaluator|
13
- u.confirm! if evaluator.confirm_account
13
+ u.confirm if evaluator.confirm_account
14
14
  end
15
15
 
16
16
  trait :with_reset_password_token do
@@ -12,7 +12,7 @@ FactoryGirl.define do
12
12
  end
13
13
 
14
14
  after(:create) do |u, evaluator|
15
- u.confirm! if evaluator.confirm_account
15
+ u.confirm if evaluator.confirm_account
16
16
  end
17
17
 
18
18
  trait :with_reset_password_token do
@@ -18,16 +18,8 @@ shared_examples "token authenticatable" do
18
18
  expect { subject }.to change { entity.authentication_token }
19
19
  end
20
20
 
21
- context "token created at" do
22
- it "should reset" do
23
- swap Devise::TokenAuthenticatable, token_expires_in: 1.hour do
24
- expect { subject }.to change { entity.authentication_token_created_at }
25
- end
26
- end
27
-
28
- it "should not reset when token expires in not set" do
29
- expect { subject }.to_not change { entity.authentication_token_created_at }
30
- end
21
+ it "should reset token created at" do
22
+ expect { subject }.to change { entity.authentication_token_created_at }
31
23
  end
32
24
  end
33
25
 
@@ -58,16 +50,8 @@ shared_examples "token authenticatable" do
58
50
  expect { subject }.to change { entity.authentication_token }
59
51
  end
60
52
 
61
- context "token created at" do
62
- it "should set" do
63
- swap Devise::TokenAuthenticatable, token_expires_in: 1.hour do
64
- expect { subject }.to change { entity.authentication_token_created_at }
65
- end
66
- end
67
-
68
- it "should not set when token expires in disabled" do
69
- expect { subject }.to_not change { entity.authentication_token_created_at }
70
- end
53
+ it "should set authentication token created at" do
54
+ expect { subject }.to change { entity.authentication_token_created_at }
71
55
  end
72
56
  end
73
57
  end
@@ -105,19 +89,11 @@ shared_examples "token authenticatable" do
105
89
  end
106
90
 
107
91
  describe "#required_fields" do
108
- it "should contain the fields that Devise uses when token expires in disabled" do
92
+ it "should contain the fields that Devise uses" do
109
93
  expect(Devise::Models::TokenAuthenticatable.required_fields(described_class)).to eq([
110
- :authentication_token
94
+ :authentication_token, :authentication_token_created_at
111
95
  ])
112
96
  end
113
-
114
- it "should contain the fields that Devise uses" do
115
- swap Devise::TokenAuthenticatable, token_expires_in: 1.hour do
116
- expect(Devise::Models::TokenAuthenticatable.required_fields(described_class)).to eq([
117
- :authentication_token, :authentication_token_created_at
118
- ])
119
- end
120
- end
121
97
  end
122
98
 
123
99
  end
@@ -1,7 +1,7 @@
1
1
  class User < ActiveRecord::Base
2
2
  devise :database_authenticatable, :confirmable, :lockable, :recoverable,
3
3
  :registerable, :rememberable, :timeoutable, :token_authenticatable,
4
- :trackable, :validatable
4
+ :trackable, :validatable, reconfirmable: false
5
5
 
6
6
  attr_accessor :other_key
7
7
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devise-token_authenticatable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.10
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sebastian Oelke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-23 00:00:00.000000000 Z
11
+ date: 2016-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: devise
@@ -16,34 +16,34 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 3.5.2
19
+ version: 4.0.0
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: 4.0.0
22
+ version: 4.2.0
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: 3.5.2
29
+ version: 4.0.0
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: 4.0.0
32
+ version: 4.2.0
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: rails
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '4.1'
39
+ version: '4.2'
40
40
  type: :development
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '4.1'
46
+ version: '4.2'
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rspec-rails
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -208,7 +208,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
208
208
  version: '0'
209
209
  requirements: []
210
210
  rubyforge_project:
211
- rubygems_version: 2.4.5.1
211
+ rubygems_version: 2.2.2
212
212
  signing_key:
213
213
  specification_version: 4
214
214
  summary: Provides authentication based on an authentication token for devise 3.2 and