devise 3.3.0 → 3.4.0

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.

Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -1
  3. data/CHANGELOG.md +23 -1
  4. data/Gemfile +2 -2
  5. data/Gemfile.lock +81 -55
  6. data/README.md +28 -5
  7. data/app/controllers/devise/confirmations_controller.rb +1 -1
  8. data/app/views/devise/shared/{_links.erb → _links.html.erb} +0 -0
  9. data/config/locales/en.yml +2 -2
  10. data/devise.gemspec +1 -0
  11. data/gemfiles/Gemfile.rails-3.2-stable.lock +5 -2
  12. data/gemfiles/Gemfile.rails-4.0-stable.lock +25 -22
  13. data/gemfiles/{Gemfile.rails-head → Gemfile.rails-4.1-stable} +2 -5
  14. data/gemfiles/{Gemfile.rails-head.lock → Gemfile.rails-4.1-stable.lock} +45 -65
  15. data/lib/devise.rb +2 -1
  16. data/lib/devise/failure_app.rb +6 -1
  17. data/lib/devise/mapping.rb +1 -1
  18. data/lib/devise/models/authenticatable.rb +8 -2
  19. data/lib/devise/models/lockable.rb +2 -2
  20. data/lib/devise/rails/routes.rb +6 -9
  21. data/lib/devise/strategies/authenticatable.rb +1 -2
  22. data/lib/devise/strategies/database_authenticatable.rb +1 -0
  23. data/lib/devise/strategies/rememberable.rb +6 -3
  24. data/lib/devise/version.rb +1 -1
  25. data/lib/generators/active_record/devise_generator.rb +2 -1
  26. data/lib/generators/devise/controllers_generator.rb +44 -0
  27. data/lib/generators/templates/controllers/README +14 -0
  28. data/lib/generators/templates/controllers/confirmations_controller.rb +28 -0
  29. data/lib/generators/templates/controllers/omniauth_callbacks_controller.rb +28 -0
  30. data/lib/generators/templates/controllers/passwords_controller.rb +32 -0
  31. data/lib/generators/templates/controllers/registrations_controller.rb +60 -0
  32. data/lib/generators/templates/controllers/sessions_controller.rb +25 -0
  33. data/lib/generators/templates/controllers/unlocks_controller.rb +28 -0
  34. data/lib/generators/templates/devise.rb +2 -2
  35. data/lib/generators/templates/simple_form_for/registrations/new.html.erb +1 -1
  36. data/lib/generators/templates/simple_form_for/sessions/new.html.erb +2 -2
  37. data/test/controllers/url_helpers_test.rb +6 -0
  38. data/test/generators/controllers_generator_test.rb +48 -0
  39. data/test/generators/views_generator_test.rb +1 -1
  40. data/test/helpers/devise_helper_test.rb +9 -12
  41. data/test/integration/authenticatable_test.rb +1 -1
  42. data/test/integration/http_authenticatable_test.rb +1 -1
  43. data/test/mapping_test.rb +1 -0
  44. data/test/models/authenticatable_test.rb +10 -0
  45. data/test/models/confirmable_test.rb +5 -4
  46. data/test/models/lockable_test.rb +16 -10
  47. data/test/rails_app/app/mailers/users/from_proc_mailer.rb +3 -0
  48. data/test/rails_app/app/mailers/users/mailer.rb +0 -9
  49. data/test/rails_app/app/mailers/users/reply_to_mailer.rb +4 -0
  50. data/test/rails_app/db/migrate/20100401102949_create_tables.rb +2 -2
  51. data/test/support/helpers.rb +9 -6
  52. data/test/test_helper.rb +5 -0
  53. metadata +33 -5
@@ -299,18 +299,24 @@ class LockableTest < ActiveSupport::TestCase
299
299
  end
300
300
 
301
301
  test 'should return last attempt message if user made next-to-last attempt of password entering' do
302
- swap Devise, last_attempt_warning: :true do
303
- swap Devise, lock_strategy: :failed_attempts do
304
- user = create_user
305
- user.failed_attempts = Devise.maximum_attempts - 2
306
- assert_equal :invalid, user.unauthenticated_message
302
+ swap Devise, last_attempt_warning: true, lock_strategy: :failed_attempts do
303
+ user = create_user
304
+ user.failed_attempts = Devise.maximum_attempts - 2
305
+ assert_equal :invalid, user.unauthenticated_message
307
306
 
308
- user.failed_attempts = Devise.maximum_attempts - 1
309
- assert_equal :last_attempt, user.unauthenticated_message
307
+ user.failed_attempts = Devise.maximum_attempts - 1
308
+ assert_equal :last_attempt, user.unauthenticated_message
310
309
 
311
- user.failed_attempts = Devise.maximum_attempts
312
- assert_equal :locked, user.unauthenticated_message
313
- end
310
+ user.failed_attempts = Devise.maximum_attempts
311
+ assert_equal :locked, user.unauthenticated_message
312
+ end
313
+ end
314
+
315
+ test 'should not return last attempt message if last_attempt_warning is disabled' do
316
+ swap Devise, last_attempt_warning: false, lock_strategy: :failed_attempts do
317
+ user = create_user
318
+ user.failed_attempts = Devise.maximum_attempts - 1
319
+ assert_equal :invalid, user.unauthenticated_message
314
320
  end
315
321
  end
316
322
 
@@ -0,0 +1,3 @@
1
+ class Users::FromProcMailer < Devise::Mailer
2
+ default from: proc { 'custom@example.com' }
3
+ end
@@ -1,12 +1,3 @@
1
1
  class Users::Mailer < Devise::Mailer
2
2
  default from: 'custom@example.com'
3
3
  end
4
-
5
- class Users::ReplyToMailer < Devise::Mailer
6
- default from: 'custom@example.com'
7
- default reply_to: 'custom_reply_to@example.com'
8
- end
9
-
10
- class Users::FromProcMailer < Devise::Mailer
11
- default from: proc { 'custom@example.com' }
12
- end
@@ -0,0 +1,4 @@
1
+ class Users::ReplyToMailer < Devise::Mailer
2
+ default from: 'custom@example.com'
3
+ default reply_to: 'custom_reply_to@example.com'
4
+ end
@@ -33,7 +33,7 @@ class CreateTables < ActiveRecord::Migration
33
33
  t.string :unlock_token # Only if unlock strategy is :email or :both
34
34
  t.datetime :locked_at
35
35
 
36
- t.timestamps
36
+ t.timestamps null: false
37
37
  end
38
38
 
39
39
  create_table :admins do |t|
@@ -60,7 +60,7 @@ class CreateTables < ActiveRecord::Migration
60
60
  ## Attribute for testing route blocks
61
61
  t.boolean :active, default: false
62
62
 
63
- t.timestamps
63
+ t.timestamps null: false
64
64
  end
65
65
  end
66
66
 
@@ -8,12 +8,15 @@ class ActiveSupport::TestCase
8
8
  end
9
9
 
10
10
  def store_translations(locale, translations, &block)
11
- begin
12
- I18n.backend.store_translations(locale, translations)
13
- yield
14
- ensure
15
- I18n.reload!
16
- end
11
+ # Calling 'available_locales' before storing the translations to ensure
12
+ # that the I18n backend will be initialized before we store our custom
13
+ # translations, so they will always override the translations for the
14
+ # YML file.
15
+ I18n.available_locales
16
+ I18n.backend.store_translations(locale, translations)
17
+ yield
18
+ ensure
19
+ I18n.reload!
17
20
  end
18
21
 
19
22
  def generate_unique_email
@@ -17,6 +17,10 @@ Webrat.configure do |config|
17
17
  config.open_error_files = false
18
18
  end
19
19
 
20
+ if ActiveSupport.respond_to?(:test_order)
21
+ ActiveSupport.test_order = :random
22
+ end
23
+
20
24
  OmniAuth.config.logger = Logger.new('/dev/null')
21
25
 
22
26
  # Add support to load paths so we can overwrite broken webrat setup
@@ -27,3 +31,4 @@ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
27
31
  require "rails/generators/test_case"
28
32
  require "generators/devise/install_generator"
29
33
  require "generators/devise/views_generator"
34
+ require "generators/devise/controllers_generator"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devise
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.0
4
+ version: 3.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - José Valim
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-08-13 00:00:00.000000000 Z
12
+ date: 2014-10-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: warden
@@ -87,6 +87,20 @@ dependencies:
87
87
  - - "<"
88
88
  - !ruby/object:Gem::Version
89
89
  version: '5'
90
+ - !ruby/object:Gem::Dependency
91
+ name: responders
92
+ requirement: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ type: :runtime
98
+ prerelease: false
99
+ version_requirements: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
90
104
  description: Flexible authentication solution for Rails with Warden
91
105
  email: contact@plataformatec.com.br
92
106
  executables: []
@@ -121,7 +135,7 @@ files:
121
135
  - app/views/devise/registrations/edit.html.erb
122
136
  - app/views/devise/registrations/new.html.erb
123
137
  - app/views/devise/sessions/new.html.erb
124
- - app/views/devise/shared/_links.erb
138
+ - app/views/devise/shared/_links.html.erb
125
139
  - app/views/devise/unlocks/new.html.erb
126
140
  - config/locales/en.yml
127
141
  - devise.gemspec
@@ -130,8 +144,8 @@ files:
130
144
  - gemfiles/Gemfile.rails-3.2-stable.lock
131
145
  - gemfiles/Gemfile.rails-4.0-stable
132
146
  - gemfiles/Gemfile.rails-4.0-stable.lock
133
- - gemfiles/Gemfile.rails-head
134
- - gemfiles/Gemfile.rails-head.lock
147
+ - gemfiles/Gemfile.rails-4.1-stable
148
+ - gemfiles/Gemfile.rails-4.1-stable.lock
135
149
  - lib/devise.rb
136
150
  - lib/devise/controllers/helpers.rb
137
151
  - lib/devise/controllers/rememberable.rb
@@ -185,12 +199,20 @@ files:
185
199
  - lib/generators/active_record/devise_generator.rb
186
200
  - lib/generators/active_record/templates/migration.rb
187
201
  - lib/generators/active_record/templates/migration_existing.rb
202
+ - lib/generators/devise/controllers_generator.rb
188
203
  - lib/generators/devise/devise_generator.rb
189
204
  - lib/generators/devise/install_generator.rb
190
205
  - lib/generators/devise/orm_helpers.rb
191
206
  - lib/generators/devise/views_generator.rb
192
207
  - lib/generators/mongoid/devise_generator.rb
193
208
  - lib/generators/templates/README
209
+ - lib/generators/templates/controllers/README
210
+ - lib/generators/templates/controllers/confirmations_controller.rb
211
+ - lib/generators/templates/controllers/omniauth_callbacks_controller.rb
212
+ - lib/generators/templates/controllers/passwords_controller.rb
213
+ - lib/generators/templates/controllers/registrations_controller.rb
214
+ - lib/generators/templates/controllers/sessions_controller.rb
215
+ - lib/generators/templates/controllers/unlocks_controller.rb
194
216
  - lib/generators/templates/devise.rb
195
217
  - lib/generators/templates/markerb/confirmation_instructions.markerb
196
218
  - lib/generators/templates/markerb/reset_password_instructions.markerb
@@ -215,6 +237,7 @@ files:
215
237
  - test/devise_test.rb
216
238
  - test/failure_app_test.rb
217
239
  - test/generators/active_record_generator_test.rb
240
+ - test/generators/controllers_generator_test.rb
218
241
  - test/generators/devise_generator_test.rb
219
242
  - test/generators/install_generator_test.rb
220
243
  - test/generators/mongoid_generator_test.rb
@@ -270,7 +293,9 @@ files:
270
293
  - test/rails_app/app/controllers/users/omniauth_callbacks_controller.rb
271
294
  - test/rails_app/app/controllers/users_controller.rb
272
295
  - test/rails_app/app/helpers/application_helper.rb
296
+ - test/rails_app/app/mailers/users/from_proc_mailer.rb
273
297
  - test/rails_app/app/mailers/users/mailer.rb
298
+ - test/rails_app/app/mailers/users/reply_to_mailer.rb
274
299
  - test/rails_app/app/mongoid/admin.rb
275
300
  - test/rails_app/app/mongoid/shim.rb
276
301
  - test/rails_app/app/mongoid/user.rb
@@ -361,6 +386,7 @@ test_files:
361
386
  - test/devise_test.rb
362
387
  - test/failure_app_test.rb
363
388
  - test/generators/active_record_generator_test.rb
389
+ - test/generators/controllers_generator_test.rb
364
390
  - test/generators/devise_generator_test.rb
365
391
  - test/generators/install_generator_test.rb
366
392
  - test/generators/mongoid_generator_test.rb
@@ -416,7 +442,9 @@ test_files:
416
442
  - test/rails_app/app/controllers/users/omniauth_callbacks_controller.rb
417
443
  - test/rails_app/app/controllers/users_controller.rb
418
444
  - test/rails_app/app/helpers/application_helper.rb
445
+ - test/rails_app/app/mailers/users/from_proc_mailer.rb
419
446
  - test/rails_app/app/mailers/users/mailer.rb
447
+ - test/rails_app/app/mailers/users/reply_to_mailer.rb
420
448
  - test/rails_app/app/mongoid/admin.rb
421
449
  - test/rails_app/app/mongoid/shim.rb
422
450
  - test/rails_app/app/mongoid/user.rb