devise 2.1.2 → 2.1.3
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of devise might be problematic. Click here for more details.
data/CHANGELOG.rdoc
CHANGED
@@ -205,21 +205,20 @@ module Devise
|
|
205
205
|
# namedscope to filter records while authenticating.
|
206
206
|
# Example:
|
207
207
|
#
|
208
|
-
# def self.find_for_authentication(
|
209
|
-
#
|
210
|
-
# super
|
208
|
+
# def self.find_for_authentication(tainted_conditions)
|
209
|
+
# find_first_by_auth_conditions(tainted_conditions, active: true)
|
211
210
|
# end
|
212
211
|
#
|
213
212
|
# Finally, notice that Devise also queries for users in other scenarios
|
214
213
|
# besides authentication, for example when retrieving an user to send
|
215
214
|
# an e-mail for password reset. In such cases, find_for_authentication
|
216
215
|
# is not called.
|
217
|
-
def find_for_authentication(
|
218
|
-
find_first_by_auth_conditions(
|
216
|
+
def find_for_authentication(tainted_conditions)
|
217
|
+
find_first_by_auth_conditions(tainted_conditions)
|
219
218
|
end
|
220
219
|
|
221
|
-
def find_first_by_auth_conditions(
|
222
|
-
to_adapter.find_first
|
220
|
+
def find_first_by_auth_conditions(tainted_conditions, opts={})
|
221
|
+
to_adapter.find_first(devise_param_filter.filter(tainted_conditions).merge(opts))
|
223
222
|
end
|
224
223
|
|
225
224
|
# Find an initialize a record setting an error if it can't be found.
|
data/lib/devise/param_filter.rb
CHANGED
@@ -33,9 +33,8 @@ module Devise
|
|
33
33
|
|
34
34
|
private
|
35
35
|
|
36
|
-
# Determine which values should be transformed to string or passed as-is to the query builder underneath
|
37
36
|
def param_requires_string_conversion?(value)
|
38
|
-
|
37
|
+
true
|
39
38
|
end
|
40
39
|
end
|
41
40
|
end
|
data/lib/devise/version.rb
CHANGED
@@ -4,4 +4,10 @@ class AuthenticatableTest < ActiveSupport::TestCase
|
|
4
4
|
test 'required_fields should be an empty array' do
|
5
5
|
assert_equal Devise::Models::Validatable.required_fields(User), []
|
6
6
|
end
|
7
|
-
|
7
|
+
|
8
|
+
test 'find_first_by_auth_conditions allows custom filtering parameters' do
|
9
|
+
user = User.create!(email: "example@example.com", password: "123456")
|
10
|
+
assert_equal User.find_first_by_auth_conditions({ email: "example@example.com" }), user
|
11
|
+
assert_equal User.find_first_by_auth_conditions({ email: "example@example.com" }, id: user.id + 1), nil
|
12
|
+
end
|
13
|
+
end
|
@@ -23,15 +23,9 @@ class DatabaseAuthenticatableTest < ActiveSupport::TestCase
|
|
23
23
|
end
|
24
24
|
|
25
25
|
test "param filter should not convert booleans and integer to strings" do
|
26
|
-
conditions = {
|
26
|
+
conditions = { "login" => "foo@bar.com", "bool1" => true, "bool2" => false, "fixnum" => 123, "will_be_converted" => (1..10) }
|
27
27
|
conditions = Devise::ParamFilter.new([], []).filter(conditions)
|
28
|
-
assert_equal( {
|
29
|
-
end
|
30
|
-
|
31
|
-
test "param filter should not convert regular expressions to strings" do
|
32
|
-
conditions = { "regexp" => /expression/ }
|
33
|
-
conditions = Devise::ParamFilter.new([], []).filter(conditions)
|
34
|
-
assert_equal( { "regexp" => /expression/ }, conditions)
|
28
|
+
assert_equal( { "login" => "foo@bar.com", "bool1" => "true", "bool2" => "false", "fixnum" => "123", "will_be_converted" => "1..10" }, conditions)
|
35
29
|
end
|
36
30
|
|
37
31
|
test 'should respond to password and password confirmation' do
|
@@ -186,4 +180,4 @@ class DatabaseAuthenticatableTest < ActiveSupport::TestCase
|
|
186
180
|
]
|
187
181
|
end
|
188
182
|
end
|
189
|
-
end
|
183
|
+
end
|
metadata
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devise
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.2
|
5
4
|
prerelease:
|
5
|
+
version: 2.1.3
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- José Valim
|
@@ -10,52 +10,72 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2013-01-26 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
|
-
|
17
|
-
requirement: &2157810840 !ruby/object:Gem::Requirement
|
18
|
-
none: false
|
16
|
+
version_requirements: !ruby/object:Gem::Requirement
|
19
17
|
requirements:
|
20
18
|
- - ~>
|
21
19
|
- !ruby/object:Gem::Version
|
22
20
|
version: 1.2.1
|
21
|
+
none: false
|
22
|
+
name: warden
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
25
|
+
requirement: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 1.2.1
|
29
30
|
none: false
|
31
|
+
- !ruby/object:Gem::Dependency
|
32
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
33
|
requirements:
|
31
34
|
- - ~>
|
32
35
|
- !ruby/object:Gem::Version
|
33
36
|
version: '0.1'
|
37
|
+
none: false
|
38
|
+
name: orm_adapter
|
34
39
|
type: :runtime
|
35
40
|
prerelease: false
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
41
|
+
requirement: !ruby/object:Gem::Requirement
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0.1'
|
40
46
|
none: false
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
49
|
requirements:
|
42
50
|
- - ~>
|
43
51
|
- !ruby/object:Gem::Version
|
44
52
|
version: '3.0'
|
53
|
+
none: false
|
54
|
+
name: bcrypt-ruby
|
45
55
|
type: :runtime
|
46
56
|
prerelease: false
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.0'
|
51
62
|
none: false
|
63
|
+
- !ruby/object:Gem::Dependency
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
65
|
requirements:
|
53
66
|
- - ~>
|
54
67
|
- !ruby/object:Gem::Version
|
55
68
|
version: '3.1'
|
69
|
+
none: false
|
70
|
+
name: railties
|
56
71
|
type: :runtime
|
57
72
|
prerelease: false
|
58
|
-
|
73
|
+
requirement: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '3.1'
|
78
|
+
none: false
|
59
79
|
description: Flexible authentication solution for Rails with Warden
|
60
80
|
email: contact@plataformatec.com.br
|
61
81
|
executables: []
|
@@ -274,20 +294,20 @@ rdoc_options: []
|
|
274
294
|
require_paths:
|
275
295
|
- lib
|
276
296
|
required_ruby_version: !ruby/object:Gem::Requirement
|
277
|
-
none: false
|
278
297
|
requirements:
|
279
298
|
- - ! '>='
|
280
299
|
- !ruby/object:Gem::Version
|
281
300
|
version: '0'
|
282
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
283
301
|
none: false
|
302
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
284
303
|
requirements:
|
285
304
|
- - ! '>='
|
286
305
|
- !ruby/object:Gem::Version
|
287
306
|
version: '0'
|
307
|
+
none: false
|
288
308
|
requirements: []
|
289
309
|
rubyforge_project: devise
|
290
|
-
rubygems_version: 1.8.
|
310
|
+
rubygems_version: 1.8.23
|
291
311
|
signing_key:
|
292
312
|
specification_version: 3
|
293
313
|
summary: Flexible authentication solution for Rails with Warden
|
@@ -399,4 +419,3 @@ test_files:
|
|
399
419
|
- test/support/webrat/integrations/rails.rb
|
400
420
|
- test/test_helper.rb
|
401
421
|
- test/test_helpers_test.rb
|
402
|
-
has_rdoc:
|