devise-token_authenticatable 0.3.1 → 0.3.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bea08f81073cdde966185ff2d4f09eae50dfdb6d
|
4
|
+
data.tar.gz: 87a1f8e1208e4243d3822d51bba622fffc3bc78a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0a9a308790adc4acaa705e966621efe85cef97b52a7e3d1c051754b153d0b969c885f304262f07bf5427c048771c4a4b6e289b31fa06097eda7a0bfbb8e7da6
|
7
|
+
data.tar.gz: 1890a1ffb5065b8032ef542854203944a088e5699eeed1ee6fd0d3059dfec7888394c42b00fa51e8b88e549e5bb64d1b256e0d7e09fd6d636cb59f0e601f9858
|
@@ -32,7 +32,12 @@ module Devise
|
|
32
32
|
module ClassMethods
|
33
33
|
|
34
34
|
def find_for_token_authentication(conditions)
|
35
|
-
|
35
|
+
auth_conditions = conditions.dup
|
36
|
+
authentication_token = auth_conditions.delete(Devise::TokenAuthenticatable.token_authentication_key)
|
37
|
+
|
38
|
+
find_for_authentication(
|
39
|
+
auth_conditions.merge(authentication_token: authentication_token)
|
40
|
+
)
|
36
41
|
end
|
37
42
|
|
38
43
|
# Generate a token checking if one does not already exist in the database.
|
@@ -89,7 +94,6 @@ module Devise
|
|
89
94
|
def ensure_authentication_token_before_save
|
90
95
|
ensure_authentication_token if Devise::TokenAuthenticatable.should_ensure_authentication_token
|
91
96
|
end
|
92
|
-
|
93
97
|
end
|
94
98
|
end
|
95
99
|
end
|
data/spec/factories/user.rb
CHANGED
@@ -51,6 +51,15 @@ shared_examples "token authenticatable" do
|
|
51
51
|
expect(entity.authentication_token).to eq(authenticated_entity.authentication_token)
|
52
52
|
end
|
53
53
|
|
54
|
+
it "should authenticate with all the options passed in, not just the auth_token" do
|
55
|
+
conditions = {facebook_token: entity.facebook_token, auth_token: entity.authentication_token}
|
56
|
+
expected_conditions = {facebook_token: entity.facebook_token, authentication_token: entity.authentication_token}
|
57
|
+
|
58
|
+
expect(described_class).to receive(:find_for_authentication).with(expected_conditions).and_call_original
|
59
|
+
|
60
|
+
described_class.find_for_token_authentication(conditions)
|
61
|
+
end
|
62
|
+
|
54
63
|
it "should return nil when authenticating an invalid entity by authentication token" do
|
55
64
|
authenticated_entity = described_class.find_for_token_authentication(auth_token: entity.authentication_token.reverse)
|
56
65
|
expect(authenticated_entity).to be_nil
|
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.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sebastian Oelke
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: devise
|