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: 3f3ab41f44f9d2b947755138573fac61db295d5a
4
- data.tar.gz: 2ea7960b707e719f26bf13fa53d18c92d964ae90
3
+ metadata.gz: bea08f81073cdde966185ff2d4f09eae50dfdb6d
4
+ data.tar.gz: 87a1f8e1208e4243d3822d51bba622fffc3bc78a
5
5
  SHA512:
6
- metadata.gz: 1da828318ff32ff89522262dc366c5eb60d1308ae3da8c0dea18cb3afe0f4f0e8bd5acf1c4f0ab4cf96cc74cb8a0d42297de6d7ee39b8d0d191ee9ebf0bd5af0
7
- data.tar.gz: ba3cd720cf3883632686a705072486ff21248d5453f520795ed32a46c513b74a7fea5b9ee6cb788d30e83c5b299f07b8758d724e90fdbb2d7421190f91728063
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
- find_for_authentication(authentication_token: conditions[Devise::TokenAuthenticatable.token_authentication_key])
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
@@ -1,5 +1,5 @@
1
1
  module Devise
2
2
  module TokenAuthenticatable
3
- VERSION = "0.3.1".freeze
3
+ VERSION = "0.3.2".freeze
4
4
  end
5
5
  end
@@ -5,6 +5,7 @@ FactoryGirl.define do
5
5
  sequence(:email) { |n| "user#{n}@domain.com" }
6
6
  password 'some_password'
7
7
  password_confirmation 'some_password'
8
+ facebook_token { SecureRandom.hex }
8
9
 
9
10
  ignore do
10
11
  confirm_account true
@@ -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.1
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-15 00:00:00.000000000 Z
11
+ date: 2015-05-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: devise