devise 4.0.0.rc1 → 4.0.0.rc2

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.

Potentially problematic release.


This version of devise might be problematic. Click here for more details.

Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +6 -6
  3. data/CHANGELOG.md +15 -0
  4. data/Gemfile +3 -3
  5. data/Gemfile.lock +52 -53
  6. data/README.md +3 -6
  7. data/app/controllers/devise/confirmations_controller.rb +1 -1
  8. data/app/controllers/devise/passwords_controller.rb +2 -2
  9. data/app/controllers/devise/registrations_controller.rb +3 -3
  10. data/app/controllers/devise/sessions_controller.rb +3 -3
  11. data/app/controllers/devise/unlocks_controller.rb +1 -1
  12. data/app/controllers/devise_controller.rb +9 -2
  13. data/app/views/devise/confirmations/new.html.erb +1 -1
  14. data/bin/test +13 -0
  15. data/gemfiles/Gemfile.rails-4.1-stable +4 -4
  16. data/gemfiles/Gemfile.rails-4.1-stable.lock +45 -46
  17. data/gemfiles/Gemfile.rails-4.2-stable +4 -4
  18. data/gemfiles/Gemfile.rails-4.2-stable.lock +47 -48
  19. data/gemfiles/Gemfile.rails-5.0-beta +19 -19
  20. data/gemfiles/Gemfile.rails-5.0-beta.lock +61 -106
  21. data/lib/devise.rb +4 -4
  22. data/lib/devise/controllers/helpers.rb +1 -1
  23. data/lib/devise/encryptor.rb +4 -4
  24. data/lib/devise/failure_app.rb +4 -5
  25. data/lib/devise/mailers/helpers.rb +1 -1
  26. data/lib/devise/models/confirmable.rb +2 -2
  27. data/lib/devise/models/database_authenticatable.rb +7 -5
  28. data/lib/devise/models/lockable.rb +1 -1
  29. data/lib/devise/omniauth/url_helpers.rb +62 -4
  30. data/lib/devise/rails/routes.rb +14 -16
  31. data/lib/devise/strategies/database_authenticatable.rb +3 -3
  32. data/lib/devise/test_helpers.rb +1 -1
  33. data/lib/devise/version.rb +1 -1
  34. data/lib/generators/active_record/devise_generator.rb +8 -2
  35. data/lib/generators/active_record/templates/migration.rb +1 -1
  36. data/lib/generators/active_record/templates/migration_existing.rb +1 -1
  37. data/lib/generators/devise/install_generator.rb +15 -0
  38. data/lib/generators/templates/devise.rb +10 -10
  39. data/test/failure_app_test.rb +1 -1
  40. data/test/generators/install_generator_test.rb +14 -3
  41. data/test/mailers/confirmation_instructions_test.rb +6 -6
  42. data/test/mailers/reset_password_instructions_test.rb +5 -5
  43. data/test/mailers/unlock_instructions_test.rb +5 -5
  44. data/test/models/confirmable_test.rb +2 -2
  45. data/test/models/database_authenticatable_test.rb +6 -6
  46. data/test/omniauth/url_helpers_test.rb +4 -6
  47. data/test/rails_app/config/initializers/devise.rb +1 -1
  48. data/test/routes_test.rb +2 -2
  49. data/test/test_helpers_test.rb +2 -2
  50. data/test/test_models.rb +1 -1
  51. metadata +4 -2
@@ -37,16 +37,16 @@ class ConfirmationInstructionsTest < ActionMailer::TestCase
37
37
  assert_equal [user.email], mail.to
38
38
  end
39
39
 
40
- test 'setup sender from configuration' do
40
+ test 'set up sender from configuration' do
41
41
  assert_equal ['test@example.com'], mail.from
42
42
  end
43
43
 
44
- test 'setup sender from custom mailer defaults' do
44
+ test 'set up sender from custom mailer defaults' do
45
45
  Devise.mailer = 'Users::Mailer'
46
46
  assert_equal ['custom@example.com'], mail.from
47
47
  end
48
48
 
49
- test 'setup sender from custom mailer defaults with proc' do
49
+ test 'set up sender from custom mailer defaults with proc' do
50
50
  Devise.mailer = 'Users::FromProcMailer'
51
51
  assert_equal ['custom@example.com'], mail.from
52
52
  end
@@ -56,17 +56,17 @@ class ConfirmationInstructionsTest < ActionMailer::TestCase
56
56
  assert_present mail.body.encoded
57
57
  end
58
58
 
59
- test 'setup reply to as copy from sender' do
59
+ test 'set up reply to as copy from sender' do
60
60
  assert_equal ['test@example.com'], mail.reply_to
61
61
  end
62
62
 
63
- test 'setup reply to as different if set in defaults' do
63
+ test 'set up reply to as different if set in defaults' do
64
64
  Devise.mailer = 'Users::ReplyToMailer'
65
65
  assert_equal ['custom@example.com'], mail.from
66
66
  assert_equal ['custom_reply_to@example.com'], mail.reply_to
67
67
  end
68
68
 
69
- test 'setup subject from I18n' do
69
+ test 'set up subject from I18n' do
70
70
  store_translations :en, devise: { mailer: { confirmation_instructions: { subject: 'Account Confirmation' } } } do
71
71
  assert_equal 'Account Confirmation', mail.subject
72
72
  end
@@ -39,16 +39,16 @@ class ResetPasswordInstructionsTest < ActionMailer::TestCase
39
39
  assert_equal [user.email], mail.to
40
40
  end
41
41
 
42
- test 'setup sender from configuration' do
42
+ test 'set up sender from configuration' do
43
43
  assert_equal ['test@example.com'], mail.from
44
44
  end
45
45
 
46
- test 'setup sender from custom mailer defaults' do
46
+ test 'set up sender from custom mailer defaults' do
47
47
  Devise.mailer = 'Users::Mailer'
48
48
  assert_equal ['custom@example.com'], mail.from
49
49
  end
50
50
 
51
- test 'setup sender from custom mailer defaults with proc' do
51
+ test 'set up sender from custom mailer defaults with proc' do
52
52
  Devise.mailer = 'Users::FromProcMailer'
53
53
  assert_equal ['custom@example.com'], mail.from
54
54
  end
@@ -58,11 +58,11 @@ class ResetPasswordInstructionsTest < ActionMailer::TestCase
58
58
  assert_present mail.body.encoded
59
59
  end
60
60
 
61
- test 'setup reply to as copy from sender' do
61
+ test 'set up reply to as copy from sender' do
62
62
  assert_equal ['test@example.com'], mail.reply_to
63
63
  end
64
64
 
65
- test 'setup subject from I18n' do
65
+ test 'set up subject from I18n' do
66
66
  store_translations :en, devise: { mailer: { reset_password_instructions: { subject: 'Reset instructions' } } } do
67
67
  assert_equal 'Reset instructions', mail.subject
68
68
  end
@@ -40,16 +40,16 @@ class UnlockInstructionsTest < ActionMailer::TestCase
40
40
  assert_equal [user.email], mail.to
41
41
  end
42
42
 
43
- test 'setup sender from configuration' do
43
+ test 'set up sender from configuration' do
44
44
  assert_equal ['test@example.com'], mail.from
45
45
  end
46
46
 
47
- test 'setup sender from custom mailer defaults' do
47
+ test 'set up sender from custom mailer defaults' do
48
48
  Devise.mailer = 'Users::Mailer'
49
49
  assert_equal ['custom@example.com'], mail.from
50
50
  end
51
51
 
52
- test 'setup sender from custom mailer defaults with proc' do
52
+ test 'set up sender from custom mailer defaults with proc' do
53
53
  Devise.mailer = 'Users::FromProcMailer'
54
54
  assert_equal ['custom@example.com'], mail.from
55
55
  end
@@ -59,11 +59,11 @@ class UnlockInstructionsTest < ActionMailer::TestCase
59
59
  assert_present mail.body.encoded
60
60
  end
61
61
 
62
- test 'setup reply to as copy from sender' do
62
+ test 'set up reply to as copy from sender' do
63
63
  assert_equal ['test@example.com'], mail.reply_to
64
64
  end
65
65
 
66
- test 'setup subject from I18n' do
66
+ test 'set up subject from I18n' do
67
67
  store_translations :en, devise: { mailer: { unlock_instructions: { subject: 'Yo unlock instructions' } } } do
68
68
  assert_equal 'Yo unlock instructions', mail.subject
69
69
  end
@@ -188,7 +188,7 @@ class ConfirmableTest < ActiveSupport::TestCase
188
188
 
189
189
  test 'confirm time should fallback to devise confirm in default configuration' do
190
190
  swap Devise, allow_unconfirmed_access_for: 1.day do
191
- user = new_user
191
+ user = create_user
192
192
  user.confirmation_sent_at = 2.days.ago
193
193
  assert_not user.active_for_authentication?
194
194
 
@@ -256,7 +256,7 @@ class ConfirmableTest < ActiveSupport::TestCase
256
256
  user.instance_eval { def confirmation_required?; false end }
257
257
  user.confirmation_sent_at = nil
258
258
  user.save
259
- assert user.reload.confirm!
259
+ assert user.reload.confirm
260
260
  end
261
261
  end
262
262
 
@@ -92,28 +92,28 @@ class DatabaseAuthenticatableTest < ActiveSupport::TestCase
92
92
  assert user.respond_to?(:password_confirmation)
93
93
  end
94
94
 
95
- test 'should generate encrypted password while setting password' do
95
+ test 'should generate a hashed password while setting password' do
96
96
  user = new_user
97
97
  assert_present user.encrypted_password
98
98
  end
99
99
 
100
- test 'should support custom encryption methods' do
101
- user = UserWithCustomEncryption.new(password: '654321')
100
+ test 'should support custom hashing methods' do
101
+ user = UserWithCustomHashing.new(password: '654321')
102
102
  assert_equal user.encrypted_password, '123456'
103
103
  end
104
104
 
105
- test 'allow authenticatable_salt to work even with nil encrypted password' do
105
+ test 'allow authenticatable_salt to work even with nil hashed password' do
106
106
  user = User.new
107
107
  user.encrypted_password = nil
108
108
  assert_nil user.authenticatable_salt
109
109
  end
110
110
 
111
- test 'should not generate encrypted password if password is blank' do
111
+ test 'should not generate a hashed password if password is blank' do
112
112
  assert_blank new_user(password: nil).encrypted_password
113
113
  assert_blank new_user(password: '').encrypted_password
114
114
  end
115
115
 
116
- test 'should encrypt password again if password has changed' do
116
+ test 'should hash password again if password has changed' do
117
117
  user = create_user
118
118
  encrypted_password = user.encrypted_password
119
119
  user.password = user.password_confirmation = 'new_password'
@@ -1,23 +1,21 @@
1
1
  require 'test_helper'
2
2
 
3
3
  class OmniAuthRoutesTest < ActionController::TestCase
4
- ExpectedUrlGeneratiorError = ActionController::UrlGenerationError
5
-
6
4
  tests ApplicationController
7
5
 
8
6
  def assert_path(action, provider, with_param=true)
9
7
  # Resource param
10
8
  assert_equal @controller.send(action, :user, provider),
11
- @controller.send("user_#{action}", provider)
9
+ @controller.send("user_#{provider}_#{action}")
12
10
 
13
11
  # With an object
14
12
  assert_equal @controller.send(action, User.new, provider),
15
- @controller.send("user_#{action}", provider)
13
+ @controller.send("user_#{provider}_#{action}")
16
14
 
17
15
  if with_param
18
16
  # Default url params
19
17
  assert_equal @controller.send(action, :user, provider, param: 123),
20
- @controller.send("user_#{action}", provider, param: 123)
18
+ @controller.send("user_#{provider}_#{action}", param: 123)
21
19
  end
22
20
  end
23
21
 
@@ -32,7 +30,7 @@ class OmniAuthRoutesTest < ActionController::TestCase
32
30
  test 'should generate authorization path' do
33
31
  assert_match "/users/auth/facebook", @controller.omniauth_authorize_path(:user, :facebook)
34
32
 
35
- assert_raise ExpectedUrlGeneratiorError do
33
+ assert_raise NoMethodError do
36
34
  @controller.omniauth_authorize_path(:user, :github)
37
35
  end
38
36
  end
@@ -135,7 +135,7 @@ Devise.setup do |config|
135
135
  # reset. Defaults to true, so a user is signed in automatically after a reset.
136
136
  # config.sign_in_after_reset_password = true
137
137
 
138
- # Setup a pepper to generate the encrypted password.
138
+ # Set up a pepper to generate the encrypted password.
139
139
  config.pepper = "d142367154e5beacca404b1a6a4f8bc52c6fdcfa3ccc3cf8eb49f3458a688ee6ac3b9fae488432a3bfca863b8a90008368a9f3a3dfbe5a962e64b6ab8f3a3a1a"
140
140
 
141
141
  # ==> Scopes configuration
@@ -96,12 +96,12 @@ class DefaultRoutingTest < ActionController::TestCase
96
96
  test 'map omniauth callbacks' do
97
97
  assert_recognizes({controller: 'users/omniauth_callbacks', action: 'facebook'}, {path: 'users/auth/facebook/callback', method: :get})
98
98
  assert_recognizes({controller: 'users/omniauth_callbacks', action: 'facebook'}, {path: 'users/auth/facebook/callback', method: :post})
99
- assert_named_route "/users/auth/facebook/callback", :user_omniauth_callback_path, :facebook
99
+ assert_named_route "/users/auth/facebook/callback", :user_facebook_omniauth_callback_path
100
100
 
101
101
  # named open_id
102
102
  assert_recognizes({controller: 'users/omniauth_callbacks', action: 'google'}, {path: 'users/auth/google/callback', method: :get})
103
103
  assert_recognizes({controller: 'users/omniauth_callbacks', action: 'google'}, {path: 'users/auth/google/callback', method: :post})
104
- assert_named_route "/users/auth/google/callback", :user_omniauth_callback_path, :google
104
+ assert_named_route "/users/auth/google/callback", :user_google_omniauth_callback_path
105
105
 
106
106
  assert_raise ExpectedRoutingError do
107
107
  assert_recognizes({controller: 'ysers/omniauth_callbacks', action: 'twitter'}, {path: 'users/auth/twitter/callback', method: :get})
@@ -68,13 +68,13 @@ class TestHelpersTest < Devise::ControllerTestCase
68
68
  test "respects custom failure app" do
69
69
  custom_failure_app = Class.new(Devise::FailureApp) do
70
70
  def redirect
71
- self.status = 306
71
+ self.status = 300
72
72
  end
73
73
  end
74
74
 
75
75
  swap Devise.warden_config, failure_app: custom_failure_app do
76
76
  get :index
77
- assert_response 306
77
+ assert_response 300
78
78
  end
79
79
  end
80
80
 
@@ -12,7 +12,7 @@ class UserWithValidation < User
12
12
  validates_presence_of :username
13
13
  end
14
14
 
15
- class UserWithCustomEncryption < User
15
+ class UserWithCustomHashing < User
16
16
  protected
17
17
  def password_digest(password)
18
18
  password.reverse
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: 4.0.0.rc1
4
+ version: 4.0.0.rc2
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: 2016-02-01 00:00:00.000000000 Z
12
+ date: 2016-03-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: warden
@@ -125,6 +125,7 @@ files:
125
125
  - app/views/devise/sessions/new.html.erb
126
126
  - app/views/devise/shared/_links.html.erb
127
127
  - app/views/devise/unlocks/new.html.erb
128
+ - bin/test
128
129
  - config/locales/en.yml
129
130
  - devise.gemspec
130
131
  - devise.png
@@ -503,3 +504,4 @@ test_files:
503
504
  - test/test_helper.rb
504
505
  - test/test_helpers_test.rb
505
506
  - test/test_models.rb
507
+ has_rdoc: