devise 2.2.0 → 2.2.1

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.

@@ -34,8 +34,9 @@ gemfile:
34
34
  services:
35
35
  - mongodb
36
36
  notifications:
37
- recipients:
38
- - jose.valim@plataformatec.com.br
39
- - carlos@plataformatec.com.br
40
- - rodrigo.flores@plataformatec.com.br
41
- - rafael.franca@plataformatec.com.br
37
+ email: false
38
+ campfire:
39
+ on_success: change
40
+ on_failure: always
41
+ rooms:
42
+ - secure: "TRiqvuM4i/QmRDWjUSNitE5/P91BOzDkNl53+bZjjtxcISCswZtmECWBR7n9\n3xwqCOU1o2lfohxZ32OHOj/Nj7o+90zWJfWxcv+if0hIXRiil62M5pg0lZUd\nyJ4M5VQ0lSWo5he1OUrXhSabPJeaK3B8yT/tdh+qO5yzR+vb/jc="
@@ -1,3 +1,9 @@
1
+ == 2.2.1
2
+
3
+ * bug fix
4
+ * Fix regression with case_insensitive_keys
5
+ * Fix regression when password is blank when it is invalid
6
+
1
7
  == 2.2.0
2
8
 
3
9
  * backwards incompatible changes
data/Gemfile CHANGED
@@ -22,8 +22,11 @@ end
22
22
 
23
23
  platforms :ruby do
24
24
  gem "sqlite3"
25
+ end
26
+
25
27
 
28
+ platforms :mri_19 do
26
29
  group :mongoid do
27
30
  gem "mongoid", "~> 3.0"
28
31
  end
29
- end
32
+ end
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- devise (2.2.0.rc)
4
+ devise (2.2.1)
5
5
  bcrypt-ruby (~> 3.0)
6
6
  orm_adapter (~> 0.1)
7
7
  railties (~> 3.1)
@@ -10,12 +10,12 @@ PATH
10
10
  GEM
11
11
  remote: http://rubygems.org/
12
12
  specs:
13
- actionmailer (3.2.9)
14
- actionpack (= 3.2.9)
13
+ actionmailer (3.2.11)
14
+ actionpack (= 3.2.11)
15
15
  mail (~> 2.4.4)
16
- actionpack (3.2.9)
17
- activemodel (= 3.2.9)
18
- activesupport (= 3.2.9)
16
+ actionpack (3.2.11)
17
+ activemodel (= 3.2.11)
18
+ activesupport (= 3.2.11)
19
19
  builder (~> 3.0.0)
20
20
  erubis (~> 2.7.0)
21
21
  journey (~> 1.0.4)
@@ -23,18 +23,18 @@ GEM
23
23
  rack-cache (~> 1.2)
24
24
  rack-test (~> 0.6.1)
25
25
  sprockets (~> 2.2.1)
26
- activemodel (3.2.9)
27
- activesupport (= 3.2.9)
26
+ activemodel (3.2.11)
27
+ activesupport (= 3.2.11)
28
28
  builder (~> 3.0.0)
29
- activerecord (3.2.9)
30
- activemodel (= 3.2.9)
31
- activesupport (= 3.2.9)
29
+ activerecord (3.2.11)
30
+ activemodel (= 3.2.11)
31
+ activesupport (= 3.2.11)
32
32
  arel (~> 3.0.2)
33
33
  tzinfo (~> 0.3.29)
34
- activeresource (3.2.9)
35
- activemodel (= 3.2.9)
36
- activesupport (= 3.2.9)
37
- activesupport (3.2.9)
34
+ activeresource (3.2.11)
35
+ activemodel (= 3.2.11)
36
+ activesupport (= 3.2.11)
37
+ activesupport (3.2.11)
38
38
  i18n (~> 0.6)
39
39
  multi_json (~> 1.0)
40
40
  arel (3.0.2)
@@ -48,7 +48,7 @@ GEM
48
48
  httpauth (0.2.0)
49
49
  i18n (0.6.1)
50
50
  journey (1.0.4)
51
- json (1.7.5)
51
+ json (1.7.6)
52
52
  jwt (0.1.5)
53
53
  multi_json (>= 1.0)
54
54
  mail (2.4.4)
@@ -59,13 +59,13 @@ GEM
59
59
  mime-types (1.19)
60
60
  mocha (0.10.0)
61
61
  metaclass (~> 0.0.1)
62
- mongoid (3.0.14)
62
+ mongoid (3.0.16)
63
63
  activemodel (~> 3.1)
64
64
  moped (~> 1.1)
65
65
  origin (~> 1.0)
66
66
  tzinfo (~> 0.3.22)
67
- moped (1.3.1)
68
- multi_json (1.4.0)
67
+ moped (1.3.2)
68
+ multi_json (1.5.0)
69
69
  multipart-post (1.1.5)
70
70
  nokogiri (1.5.5)
71
71
  oauth2 (0.8.0)
@@ -88,7 +88,7 @@ GEM
88
88
  origin (1.0.11)
89
89
  orm_adapter (0.4.0)
90
90
  polyglot (0.3.3)
91
- rack (1.4.1)
91
+ rack (1.4.3)
92
92
  rack-cache (1.2)
93
93
  rack (>= 0.4)
94
94
  rack-openid (1.3.1)
@@ -98,22 +98,22 @@ GEM
98
98
  rack
99
99
  rack-test (0.6.2)
100
100
  rack (>= 1.0)
101
- rails (3.2.9)
102
- actionmailer (= 3.2.9)
103
- actionpack (= 3.2.9)
104
- activerecord (= 3.2.9)
105
- activeresource (= 3.2.9)
106
- activesupport (= 3.2.9)
101
+ rails (3.2.11)
102
+ actionmailer (= 3.2.11)
103
+ actionpack (= 3.2.11)
104
+ activerecord (= 3.2.11)
105
+ activeresource (= 3.2.11)
106
+ activesupport (= 3.2.11)
107
107
  bundler (~> 1.0)
108
- railties (= 3.2.9)
109
- railties (3.2.9)
110
- actionpack (= 3.2.9)
111
- activesupport (= 3.2.9)
108
+ railties (= 3.2.11)
109
+ railties (3.2.11)
110
+ actionpack (= 3.2.11)
111
+ activesupport (= 3.2.11)
112
112
  rack-ssl (~> 1.3.2)
113
113
  rake (>= 0.8.7)
114
114
  rdoc (~> 3.4)
115
115
  thor (>= 0.14.6, < 2.0)
116
- rake (10.0.2)
116
+ rake (10.0.3)
117
117
  rdoc (3.12)
118
118
  json (~> 1.4)
119
119
  ruby-openid (2.2.2)
@@ -11,7 +11,7 @@ group :test do
11
11
  gem "omniauth-facebook"
12
12
  gem "omniauth-openid", "~> 1.0.1"
13
13
  gem "webrat", "0.7.2", :require => false
14
- gem "mocha", :require => false
14
+ gem "mocha", "0.10.0", :require => false
15
15
 
16
16
  platforms :mri_18 do
17
17
  gem "ruby-debug", ">= 0.10.3"
@@ -26,8 +26,10 @@ end
26
26
 
27
27
  platforms :ruby do
28
28
  gem "sqlite3"
29
+ end
29
30
 
31
+ platforms :mri_19 do
30
32
  group :mongoid do
31
33
  gem "mongoid", "~> 3.0"
32
34
  end
33
- end
35
+ end
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- devise (2.1.2)
4
+ devise (2.2.0)
5
5
  bcrypt-ruby (~> 3.0)
6
6
  orm_adapter (~> 0.1)
7
7
  railties (~> 3.1)
@@ -10,48 +10,48 @@ PATH
10
10
  GEM
11
11
  remote: http://rubygems.org/
12
12
  specs:
13
- actionmailer (3.1.4)
14
- actionpack (= 3.1.4)
15
- mail (~> 2.3.0)
16
- actionpack (3.1.4)
17
- activemodel (= 3.1.4)
18
- activesupport (= 3.1.4)
13
+ actionmailer (3.1.10)
14
+ actionpack (= 3.1.10)
15
+ mail (~> 2.3.3)
16
+ actionpack (3.1.10)
17
+ activemodel (= 3.1.10)
18
+ activesupport (= 3.1.10)
19
19
  builder (~> 3.0.0)
20
20
  erubis (~> 2.7.0)
21
21
  i18n (~> 0.6)
22
22
  rack (~> 1.3.6)
23
- rack-cache (~> 1.1)
23
+ rack-cache (~> 1.2)
24
24
  rack-mount (~> 0.8.2)
25
25
  rack-test (~> 0.6.1)
26
- sprockets (~> 2.0.3)
27
- activemodel (3.1.4)
28
- activesupport (= 3.1.4)
26
+ sprockets (~> 2.0.4)
27
+ activemodel (3.1.10)
28
+ activesupport (= 3.1.10)
29
29
  builder (~> 3.0.0)
30
30
  i18n (~> 0.6)
31
- activerecord (3.1.4)
32
- activemodel (= 3.1.4)
33
- activesupport (= 3.1.4)
31
+ activerecord (3.1.10)
32
+ activemodel (= 3.1.10)
33
+ activesupport (= 3.1.10)
34
34
  arel (~> 2.2.3)
35
35
  tzinfo (~> 0.3.29)
36
- activeresource (3.1.4)
37
- activemodel (= 3.1.4)
38
- activesupport (= 3.1.4)
39
- activesupport (3.1.4)
40
- multi_json (~> 1.0)
41
- addressable (2.2.7)
36
+ activeresource (3.1.10)
37
+ activemodel (= 3.1.10)
38
+ activesupport (= 3.1.10)
39
+ activesupport (3.1.10)
40
+ multi_json (>= 1.0, < 1.3)
42
41
  arel (2.2.3)
43
42
  bcrypt-ruby (3.0.1)
44
- builder (3.0.0)
43
+ builder (3.0.4)
45
44
  columnize (0.3.6)
46
45
  erubis (2.7.0)
47
- faraday (0.7.6)
48
- addressable (~> 2.2)
46
+ faraday (0.8.4)
49
47
  multipart-post (~> 1.1)
50
- rack (~> 1.1)
51
48
  hashie (1.2.0)
52
49
  hike (1.2.1)
53
- i18n (0.6.0)
54
- json (1.7.0)
50
+ httpauth (0.2.0)
51
+ i18n (0.6.1)
52
+ json (1.7.6)
53
+ jwt (0.1.5)
54
+ multi_json (>= 1.0)
55
55
  linecache (0.46)
56
56
  rbx-require-relative (> 0.0.4)
57
57
  mail (2.3.3)
@@ -59,36 +59,39 @@ GEM
59
59
  mime-types (~> 1.16)
60
60
  treetop (~> 1.4.8)
61
61
  metaclass (0.0.1)
62
- mime-types (1.18)
63
- mocha (0.10.4)
62
+ mime-types (1.19)
63
+ mocha (0.10.0)
64
64
  metaclass (~> 0.0.1)
65
- mongoid (3.0.12)
65
+ mongoid (3.0.16)
66
66
  activemodel (~> 3.1)
67
67
  moped (~> 1.1)
68
68
  origin (~> 1.0)
69
69
  tzinfo (~> 0.3.22)
70
- moped (1.2.9)
71
- multi_json (1.3.4)
70
+ moped (1.3.2)
71
+ multi_json (1.2.0)
72
72
  multipart-post (1.1.5)
73
- nokogiri (1.5.0)
74
- oauth2 (0.5.2)
75
- faraday (~> 0.7)
73
+ nokogiri (1.5.6)
74
+ oauth2 (0.8.0)
75
+ faraday (~> 0.8)
76
+ httpauth (~> 0.1)
77
+ jwt (~> 0.1.4)
76
78
  multi_json (~> 1.0)
77
- omniauth (1.0.2)
79
+ rack (~> 1.2)
80
+ omniauth (1.0.3)
78
81
  hashie (~> 1.2)
79
82
  rack
80
- omniauth-facebook (1.2.0)
81
- omniauth-oauth2 (~> 1.0.0)
82
- omniauth-oauth2 (1.0.0)
83
- oauth2 (~> 0.5.0)
83
+ omniauth-facebook (1.4.0)
84
+ omniauth-oauth2 (~> 1.0.2)
85
+ omniauth-oauth2 (1.0.3)
86
+ oauth2 (~> 0.8.0)
84
87
  omniauth (~> 1.0)
85
88
  omniauth-openid (1.0.1)
86
89
  omniauth (~> 1.0)
87
90
  rack-openid (~> 1.3.1)
88
- origin (1.0.10)
91
+ origin (1.0.11)
89
92
  orm_adapter (0.4.0)
90
93
  polyglot (0.3.3)
91
- rack (1.3.6)
94
+ rack (1.3.8)
92
95
  rack-cache (1.2)
93
96
  rack (>= 0.4)
94
97
  rack-mount (0.8.3)
@@ -98,25 +101,25 @@ GEM
98
101
  ruby-openid (>= 2.1.8)
99
102
  rack-ssl (1.3.2)
100
103
  rack
101
- rack-test (0.6.1)
104
+ rack-test (0.6.2)
102
105
  rack (>= 1.0)
103
- rails (3.1.4)
104
- actionmailer (= 3.1.4)
105
- actionpack (= 3.1.4)
106
- activerecord (= 3.1.4)
107
- activeresource (= 3.1.4)
108
- activesupport (= 3.1.4)
106
+ rails (3.1.10)
107
+ actionmailer (= 3.1.10)
108
+ actionpack (= 3.1.10)
109
+ activerecord (= 3.1.10)
110
+ activeresource (= 3.1.10)
111
+ activesupport (= 3.1.10)
109
112
  bundler (~> 1.0)
110
- railties (= 3.1.4)
111
- railties (3.1.4)
112
- actionpack (= 3.1.4)
113
- activesupport (= 3.1.4)
113
+ railties (= 3.1.10)
114
+ railties (3.1.10)
115
+ actionpack (= 3.1.10)
116
+ activesupport (= 3.1.10)
114
117
  rack-ssl (~> 1.3.2)
115
118
  rake (>= 0.8.7)
116
119
  rdoc (~> 3.4)
117
120
  thor (~> 0.14.6)
118
- rake (0.9.2.2)
119
- rbx-require-relative (0.0.5)
121
+ rake (10.0.3)
122
+ rbx-require-relative (0.0.9)
120
123
  rdoc (3.12)
121
124
  json (~> 1.4)
122
125
  ruby-debug (0.10.4)
@@ -124,18 +127,18 @@ GEM
124
127
  ruby-debug-base (~> 0.10.4.0)
125
128
  ruby-debug-base (0.10.4)
126
129
  linecache (>= 0.3)
127
- ruby-openid (2.1.8)
130
+ ruby-openid (2.2.2)
128
131
  sprockets (2.0.4)
129
132
  hike (~> 1.2)
130
133
  rack (~> 1.0)
131
134
  tilt (~> 1.1, != 1.3.0)
132
- sqlite3 (1.3.5)
135
+ sqlite3 (1.3.6)
133
136
  thor (0.14.6)
134
137
  tilt (1.3.3)
135
- treetop (1.4.10)
138
+ treetop (1.4.12)
136
139
  polyglot
137
140
  polyglot (>= 0.3.1)
138
- tzinfo (0.3.33)
141
+ tzinfo (0.3.35)
139
142
  warden (1.2.1)
140
143
  rack (>= 1.0)
141
144
  webrat (0.7.2)
@@ -151,7 +154,7 @@ DEPENDENCIES
151
154
  activerecord-jdbcsqlite3-adapter
152
155
  devise!
153
156
  jruby-openssl
154
- mocha
157
+ mocha (= 0.10.0)
155
158
  mongoid (~> 3.0)
156
159
  omniauth (~> 1.0.0)
157
160
  omniauth-facebook
@@ -27,7 +27,7 @@ module Devise
27
27
 
28
28
  def headers_for(action, opts)
29
29
  headers = {
30
- :subject => translate(devise_mapping, action),
30
+ :subject => subject_for(action),
31
31
  :to => resource.email,
32
32
  :from => mailer_sender(devise_mapping),
33
33
  :reply_to => mailer_reply_to(devise_mapping),
@@ -86,8 +86,8 @@ module Devise
86
86
  # confirmation_instructions:
87
87
  # subject: '...'
88
88
  #
89
- def translate(mapping, key)
90
- I18n.t(:"#{mapping.name}_subject", :scope => [:devise, :mailer, key],
89
+ def subject_for(key)
90
+ I18n.t(:"#{devise_mapping.name}_subject", :scope => [:devise, :mailer, key],
91
91
  :default => [:subject, key.to_s.humanize])
92
92
  end
93
93
  end
@@ -168,7 +168,16 @@ module Devise
168
168
  end
169
169
 
170
170
  def apply_to_attribute_or_variable(attr, method)
171
- (self[attr] || send(attr)).try(method)
171
+ if self[attr]
172
+ self[attr].try(method)
173
+
174
+ # Use respond_to? here to avoid a regression where globally
175
+ # configured strip_whitespace_keys or case_insensitive_keys were
176
+ # attempting to strip! or downcase! when a model didn't have the
177
+ # globally configured key.
178
+ elsif respond_to?(attr)
179
+ send(attr).try(method)
180
+ end
172
181
  end
173
182
 
174
183
  module ClassMethods
@@ -64,7 +64,6 @@ module Devise
64
64
  result = if valid_password?(current_password)
65
65
  update_attributes(params, *options)
66
66
  else
67
- params.delete(:password)
68
67
  self.assign_attributes(params, *options)
69
68
  self.valid?
70
69
  self.errors.add(:current_password, current_password.blank? ? :blank : :invalid)
@@ -1,3 +1,3 @@
1
1
  module Devise
2
- VERSION = "2.2.0".freeze
2
+ VERSION = "2.2.1".freeze
3
3
  end
@@ -34,6 +34,18 @@ class DatabaseAuthenticatableTest < ActiveSupport::TestCase
34
34
  assert_equal email.strip, user.email
35
35
  end
36
36
 
37
+ test "doesn't throw exception when globally configured strip_whitespace_keys are not present on a model" do
38
+ swap Devise, :strip_whitespace_keys => [:fake_key] do
39
+ assert_nothing_raised { create_user }
40
+ end
41
+ end
42
+
43
+ test "doesn't throw exception when globally configured case_insensitive_keys are not present on a model" do
44
+ swap Devise, :case_insensitive_keys => [:fake_key] do
45
+ assert_nothing_raised { create_user }
46
+ end
47
+ end
48
+
37
49
  test "param filter should not convert booleans and integer to strings" do
38
50
  conditions = { 'login' => 'foo@bar.com', "bool1" => true, "bool2" => false, "fixnum" => 123, "will_be_converted" => (1..10) }
39
51
  conditions = Devise::ParamFilter.new([], []).filter(conditions)
@@ -120,13 +132,6 @@ class DatabaseAuthenticatableTest < ActiveSupport::TestCase
120
132
  assert_match "is invalid", user.errors[:current_password].join
121
133
  end
122
134
 
123
- test 'should not change encrypted password when it is invalid' do
124
- user = create_user
125
- assert_not user.update_with_password(:current_password => 'other',
126
- :password => 'pass4321', :password_confirmation => 'pass4321')
127
- assert_not user.encrypted_password_changed?
128
- end
129
-
130
135
  test 'should add an error to current password when it is blank' do
131
136
  user = create_user
132
137
  assert_not user.update_with_password(:password => 'pass4321',
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: devise
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 2.2.0
5
+ version: 2.2.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - José Valim
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-01-08 00:00:00.000000000 Z
13
+ date: 2013-01-11 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  version_requirements: !ruby/object:Gem::Requirement