devise 3.4.1 → 3.5.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.
- checksums.yaml +4 -4
- data/.travis.yml +26 -16
- data/CHANGELOG.md +131 -104
- data/Gemfile +1 -1
- data/Gemfile.lock +84 -85
- data/MIT-LICENSE +1 -1
- data/README.md +52 -32
- data/Rakefile +2 -1
- data/app/controllers/devise/confirmations_controller.rb +4 -0
- data/app/controllers/devise/omniauth_callbacks_controller.rb +4 -0
- data/app/controllers/devise/passwords_controller.rb +14 -4
- data/app/controllers/devise/registrations_controller.rb +10 -11
- data/app/controllers/devise/sessions_controller.rb +7 -2
- data/app/controllers/devise/unlocks_controller.rb +3 -0
- data/app/controllers/devise_controller.rb +34 -18
- data/app/views/devise/confirmations/new.html.erb +1 -1
- data/app/views/devise/passwords/edit.html.erb +3 -0
- data/app/views/devise/registrations/new.html.erb +1 -1
- data/gemfiles/Gemfile.rails-3.2-stable.lock +43 -43
- data/gemfiles/Gemfile.rails-4.0-stable.lock +45 -47
- data/gemfiles/Gemfile.rails-4.1-stable.lock +52 -53
- data/gemfiles/Gemfile.rails-4.2-stable +29 -0
- data/gemfiles/Gemfile.rails-4.2-stable.lock +191 -0
- data/lib/devise.rb +23 -28
- data/lib/devise/controllers/rememberable.rb +1 -1
- data/lib/devise/controllers/sign_in_out.rb +1 -1
- data/lib/devise/controllers/store_location.rb +3 -1
- data/lib/devise/controllers/url_helpers.rb +7 -9
- data/lib/devise/encryptor.rb +22 -0
- data/lib/devise/failure_app.rb +26 -10
- data/lib/devise/mapping.rb +1 -0
- data/lib/devise/models/authenticatable.rb +20 -26
- data/lib/devise/models/confirmable.rb +29 -7
- data/lib/devise/models/database_authenticatable.rb +6 -9
- data/lib/devise/models/recoverable.rb +22 -10
- data/lib/devise/models/rememberable.rb +16 -3
- data/lib/devise/models/trackable.rb +1 -2
- data/lib/devise/models/validatable.rb +3 -3
- data/lib/devise/rails.rb +1 -1
- data/lib/devise/rails/routes.rb +3 -3
- data/lib/devise/strategies/authenticatable.rb +5 -2
- data/lib/devise/strategies/database_authenticatable.rb +1 -1
- data/lib/devise/strategies/rememberable.rb +10 -0
- data/lib/devise/test_helpers.rb +2 -2
- data/lib/devise/version.rb +1 -1
- data/lib/generators/active_record/templates/migration.rb +1 -1
- data/lib/generators/active_record/templates/migration_existing.rb +1 -1
- data/lib/generators/templates/controllers/README +1 -1
- data/lib/generators/templates/controllers/omniauth_callbacks_controller.rb +1 -1
- data/lib/generators/templates/controllers/registrations_controller.rb +2 -2
- data/lib/generators/templates/controllers/sessions_controller.rb +1 -1
- data/lib/generators/templates/devise.rb +14 -8
- data/lib/generators/templates/simple_form_for/passwords/edit.html.erb +1 -1
- data/lib/generators/templates/simple_form_for/registrations/new.html.erb +1 -1
- data/test/controllers/custom_registrations_controller_test.rb +6 -1
- data/test/controllers/helpers_test.rb +5 -0
- data/test/controllers/inherited_controller_i18n_messages_test.rb +51 -0
- data/test/controllers/internal_helpers_test.rb +4 -4
- data/test/controllers/load_hooks_controller_test.rb +19 -0
- data/test/controllers/passwords_controller_test.rb +1 -1
- data/test/controllers/sessions_controller_test.rb +3 -3
- data/test/devise_test.rb +2 -2
- data/test/failure_app_test.rb +23 -0
- data/test/integration/database_authenticatable_test.rb +11 -0
- data/test/integration/omniauthable_test.rb +1 -1
- data/test/integration/recoverable_test.rb +13 -0
- data/test/integration/rememberable_test.rb +9 -0
- data/test/mapping_test.rb +6 -0
- data/test/models/confirmable_test.rb +47 -34
- data/test/models/lockable_test.rb +6 -6
- data/test/models/recoverable_test.rb +39 -7
- data/test/models/rememberable_test.rb +8 -2
- data/test/models/validatable_test.rb +5 -5
- data/test/rails_app/app/controllers/custom/registrations_controller.rb +10 -0
- data/test/rails_app/config/application.rb +1 -1
- data/test/rails_app/config/environments/production.rb +6 -2
- data/test/rails_app/config/environments/test.rb +7 -2
- data/test/rails_app/config/initializers/devise.rb +12 -15
- data/test/rails_app/lib/shared_user.rb +1 -1
- data/test/rails_test.rb +9 -0
- data/test/support/integration.rb +2 -2
- data/test/test_helpers_test.rb +22 -7
- data/test/test_models.rb +2 -2
- metadata +11 -2
@@ -23,13 +23,13 @@ class RecoverableTest < ActiveSupport::TestCase
|
|
23
23
|
|
24
24
|
test 'should reset password and password confirmation from params' do
|
25
25
|
user = create_user
|
26
|
-
user.reset_password
|
26
|
+
user.reset_password('123456789', '987654321')
|
27
27
|
assert_equal '123456789', user.password
|
28
28
|
assert_equal '987654321', user.password_confirmation
|
29
29
|
end
|
30
30
|
|
31
31
|
test 'should reset password and save the record' do
|
32
|
-
assert create_user.reset_password
|
32
|
+
assert create_user.reset_password('123456789', '123456789')
|
33
33
|
end
|
34
34
|
|
35
35
|
test 'should clear reset password token while reseting the password' do
|
@@ -38,7 +38,30 @@ class RecoverableTest < ActiveSupport::TestCase
|
|
38
38
|
|
39
39
|
user.send_reset_password_instructions
|
40
40
|
assert_present user.reset_password_token
|
41
|
-
assert user.reset_password
|
41
|
+
assert user.reset_password('123456789', '123456789')
|
42
|
+
assert_nil user.reset_password_token
|
43
|
+
end
|
44
|
+
|
45
|
+
test 'should clear reset password token if changing password' do
|
46
|
+
user = create_user
|
47
|
+
assert_nil user.reset_password_token
|
48
|
+
|
49
|
+
user.send_reset_password_instructions
|
50
|
+
assert_present user.reset_password_token
|
51
|
+
user.password = "123456678"
|
52
|
+
user.password_confirmation = "123456678"
|
53
|
+
user.save!
|
54
|
+
assert_nil user.reset_password_token
|
55
|
+
end
|
56
|
+
|
57
|
+
test 'should clear reset password token if changing email' do
|
58
|
+
user = create_user
|
59
|
+
assert_nil user.reset_password_token
|
60
|
+
|
61
|
+
user.send_reset_password_instructions
|
62
|
+
assert_present user.reset_password_token
|
63
|
+
user.email = "another@example.com"
|
64
|
+
user.save!
|
42
65
|
assert_nil user.reset_password_token
|
43
66
|
end
|
44
67
|
|
@@ -46,14 +69,14 @@ class RecoverableTest < ActiveSupport::TestCase
|
|
46
69
|
user = create_user
|
47
70
|
user.send_reset_password_instructions
|
48
71
|
assert_present user.reset_password_token
|
49
|
-
assert_not user.reset_password
|
72
|
+
assert_not user.reset_password('123456789', '987654321')
|
50
73
|
assert_present user.reset_password_token
|
51
74
|
end
|
52
75
|
|
53
76
|
test 'should not reset password with invalid data' do
|
54
77
|
user = create_user
|
55
78
|
user.stubs(:valid?).returns(false)
|
56
|
-
assert_not user.reset_password
|
79
|
+
assert_not user.reset_password('123456789', '987654321')
|
57
80
|
end
|
58
81
|
|
59
82
|
test 'should reset reset password token and send instructions by email' do
|
@@ -135,6 +158,7 @@ class RecoverableTest < ActiveSupport::TestCase
|
|
135
158
|
reset_password_user = User.reset_password_by_token(reset_password_token: raw, password: '')
|
136
159
|
assert_not reset_password_user.errors.empty?
|
137
160
|
assert_match "can't be blank", reset_password_user.errors[:password].join
|
161
|
+
assert_equal raw, reset_password_user.reset_password_token
|
138
162
|
end
|
139
163
|
|
140
164
|
test 'should reset successfully user password given the new password and confirmation' do
|
@@ -142,15 +166,17 @@ class RecoverableTest < ActiveSupport::TestCase
|
|
142
166
|
old_password = user.password
|
143
167
|
raw = user.send_reset_password_instructions
|
144
168
|
|
145
|
-
User.reset_password_by_token(
|
169
|
+
reset_password_user = User.reset_password_by_token(
|
146
170
|
reset_password_token: raw,
|
147
171
|
password: 'new_password',
|
148
172
|
password_confirmation: 'new_password'
|
149
173
|
)
|
150
|
-
|
174
|
+
assert_nil reset_password_user.reset_password_token
|
151
175
|
|
176
|
+
user.reload
|
152
177
|
assert_not user.valid_password?(old_password)
|
153
178
|
assert user.valid_password?('new_password')
|
179
|
+
assert_nil user.reset_password_token
|
154
180
|
end
|
155
181
|
|
156
182
|
test 'should not reset password after reset_password_within time' do
|
@@ -189,6 +215,12 @@ class RecoverableTest < ActiveSupport::TestCase
|
|
189
215
|
assert_equal User.with_reset_password_token(raw), user
|
190
216
|
end
|
191
217
|
|
218
|
+
test 'should return the same reset password token as generated' do
|
219
|
+
user = create_user
|
220
|
+
raw = user.send_reset_password_instructions
|
221
|
+
assert_equal Devise.token_generator.digest(self.class, :reset_password_token, raw), user.reset_password_token
|
222
|
+
end
|
223
|
+
|
192
224
|
test 'should return nil if a user based on the raw token is not found' do
|
193
225
|
assert_equal User.with_reset_password_token('random-token'), nil
|
194
226
|
end
|
@@ -42,9 +42,15 @@ class RememberableTest < ActiveSupport::TestCase
|
|
42
42
|
assert_equal user, User.serialize_from_cookie(user.to_key, user.authenticatable_salt)
|
43
43
|
end
|
44
44
|
|
45
|
-
test 'raises a RuntimeError if authenticatable_salt is nil' do
|
45
|
+
test 'raises a RuntimeError if authenticatable_salt is nil or empty' do
|
46
46
|
user = User.new
|
47
|
-
user.
|
47
|
+
def user.authenticable_salt; nil; end
|
48
|
+
assert_raise RuntimeError do
|
49
|
+
user.rememberable_value
|
50
|
+
end
|
51
|
+
|
52
|
+
user = User.new
|
53
|
+
def user.authenticable_salt; ""; end
|
48
54
|
assert_raise RuntimeError do
|
49
55
|
user.rememberable_value
|
50
56
|
end
|
@@ -92,10 +92,10 @@ class ValidatableTest < ActiveSupport::TestCase
|
|
92
92
|
assert_equal 'is too short (minimum is 7 characters)', user.errors[:password].join
|
93
93
|
end
|
94
94
|
|
95
|
-
test 'should require a password with maximum of
|
96
|
-
user = new_user(password: 'x'*
|
95
|
+
test 'should require a password with maximum of 72 characters long' do
|
96
|
+
user = new_user(password: 'x'*73, password_confirmation: 'x'*73)
|
97
97
|
assert user.invalid?
|
98
|
-
assert_equal 'is too long (maximum is
|
98
|
+
assert_equal 'is too long (maximum is 72 characters)', user.errors[:password].join
|
99
99
|
end
|
100
100
|
|
101
101
|
test 'should not require password length when it\'s not changed' do
|
@@ -109,10 +109,10 @@ class ValidatableTest < ActiveSupport::TestCase
|
|
109
109
|
end
|
110
110
|
|
111
111
|
test 'should complain about length even if password is not required' do
|
112
|
-
user = new_user(password: 'x'*
|
112
|
+
user = new_user(password: 'x'*73, password_confirmation: 'x'*73)
|
113
113
|
user.stubs(:password_required?).returns(false)
|
114
114
|
assert user.invalid?
|
115
|
-
assert_equal 'is too long (maximum is
|
115
|
+
assert_equal 'is too long (maximum is 72 characters)', user.errors[:password].join
|
116
116
|
end
|
117
117
|
|
118
118
|
test 'should not be included in objects with invalid API' do
|
@@ -1,4 +1,10 @@
|
|
1
1
|
class Custom::RegistrationsController < Devise::RegistrationsController
|
2
|
+
def new
|
3
|
+
super do |resource|
|
4
|
+
@new_block_called = true
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
2
8
|
def create
|
3
9
|
super do |resource|
|
4
10
|
@create_block_called = true
|
@@ -18,4 +24,8 @@ class Custom::RegistrationsController < Devise::RegistrationsController
|
|
18
24
|
def update_block_called?
|
19
25
|
@update_block_called == true
|
20
26
|
end
|
27
|
+
|
28
|
+
def new_block_called?
|
29
|
+
@new_block_called == true
|
30
|
+
end
|
21
31
|
end
|
@@ -17,7 +17,7 @@ module RailsApp
|
|
17
17
|
class Application < Rails::Application
|
18
18
|
# Add additional load paths for your own custom dirs
|
19
19
|
config.autoload_paths.reject!{ |p| p =~ /\/app\/(\w+)$/ && !%w(controllers helpers mailers views).include?($1) }
|
20
|
-
config.autoload_paths += [
|
20
|
+
config.autoload_paths += ["#{config.root}/app/#{DEVISE_ORM}"]
|
21
21
|
|
22
22
|
# Configure generators values. Many other options are available, be sure to check the documentation.
|
23
23
|
# config.generators do |g|
|
@@ -20,7 +20,11 @@ RailsApp::Application.configure do
|
|
20
20
|
# config.action_dispatch.rack_cache = true
|
21
21
|
|
22
22
|
# Disable Rails's static asset server (Apache or nginx will already do this).
|
23
|
-
|
23
|
+
if Rails.version >= "4.2.0"
|
24
|
+
config.serve_static_files = false
|
25
|
+
else
|
26
|
+
config.serve_static_assets = false
|
27
|
+
end
|
24
28
|
|
25
29
|
# Compress JavaScripts and CSS.
|
26
30
|
config.assets.js_compressor = :uglifier
|
@@ -46,7 +50,7 @@ RailsApp::Application.configure do
|
|
46
50
|
config.log_level = :info
|
47
51
|
|
48
52
|
# Prepend all log lines with the following tags.
|
49
|
-
# config.log_tags = [
|
53
|
+
# config.log_tags = [:subdomain, :uuid]
|
50
54
|
|
51
55
|
# Use a different logger for distributed setups.
|
52
56
|
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
|
@@ -12,8 +12,13 @@ RailsApp::Application.configure do
|
|
12
12
|
# preloads Rails for running tests, you may have to set it to true.
|
13
13
|
config.eager_load = false
|
14
14
|
|
15
|
-
#
|
16
|
-
|
15
|
+
# Disable serving static files from the `/public` folder by default since
|
16
|
+
# Apache or NGINX already handles this.
|
17
|
+
if Rails.version >= "4.2.0"
|
18
|
+
config.serve_static_files = true
|
19
|
+
else
|
20
|
+
config.serve_static_assets = true
|
21
|
+
end
|
17
22
|
config.static_cache_control = "public, max-age=3600"
|
18
23
|
|
19
24
|
# Show full error reports and disable caching.
|
@@ -31,7 +31,7 @@ Devise.setup do |config|
|
|
31
31
|
# session. If you need permissions, you should implement that in a before filter.
|
32
32
|
# You can also supply hash where the value is a boolean expliciting if authentication
|
33
33
|
# should be aborted or not if the value is not present. By default is empty.
|
34
|
-
# config.authentication_keys = [
|
34
|
+
# config.authentication_keys = [:email]
|
35
35
|
|
36
36
|
# Configure parameters from the request object used for authentication. Each entry
|
37
37
|
# given should be a request method and it will automatically be passed to
|
@@ -43,12 +43,12 @@ Devise.setup do |config|
|
|
43
43
|
# Configure which authentication keys should be case-insensitive.
|
44
44
|
# These keys will be downcased upon creating or modifying a user and when used
|
45
45
|
# to authenticate or find a user. Default is :email.
|
46
|
-
config.case_insensitive_keys = [
|
46
|
+
config.case_insensitive_keys = [:email]
|
47
47
|
|
48
48
|
# Configure which authentication keys should have whitespace stripped.
|
49
49
|
# These keys will have whitespace before and after removed upon creating or
|
50
50
|
# modifying a user and when used to authenticate or find a user. Default is :email.
|
51
|
-
config.strip_whitespace_keys = [
|
51
|
+
config.strip_whitespace_keys = [:email]
|
52
52
|
|
53
53
|
# Tell if authentication through request.params is enabled. True by default.
|
54
54
|
# config.params_authenticatable = true
|
@@ -77,21 +77,18 @@ Devise.setup do |config|
|
|
77
77
|
# config.allow_unconfirmed_access_for = 2.days
|
78
78
|
|
79
79
|
# Defines which key will be used when confirming an account
|
80
|
-
# config.confirmation_keys = [
|
80
|
+
# config.confirmation_keys = [:email]
|
81
81
|
|
82
82
|
# ==> Configuration for :rememberable
|
83
83
|
# The time the user will be remembered without asking for credentials again.
|
84
84
|
# config.remember_for = 2.weeks
|
85
85
|
|
86
|
-
# If true, a valid remember token can be re-used between multiple browsers.
|
87
|
-
# config.remember_across_browsers = true
|
88
|
-
|
89
86
|
# If true, extends the user's remember period when remembered via cookie.
|
90
87
|
# config.extend_remember_period = false
|
91
88
|
|
92
89
|
# ==> Configuration for :validatable
|
93
|
-
# Range for password length. Default is 8..
|
94
|
-
# config.password_length = 8..
|
90
|
+
# Range for password length. Default is 8..72.
|
91
|
+
# config.password_length = 8..72
|
95
92
|
|
96
93
|
# Regex to use to validate the email address
|
97
94
|
# config.email_regexp = /^([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})$/i
|
@@ -108,7 +105,7 @@ Devise.setup do |config|
|
|
108
105
|
# config.lock_strategy = :failed_attempts
|
109
106
|
|
110
107
|
# Defines which key will be used when locking and unlocking an account
|
111
|
-
# config.unlock_keys = [
|
108
|
+
# config.unlock_keys = [:email]
|
112
109
|
|
113
110
|
# Defines which strategy will be used to unlock an account.
|
114
111
|
# :email = Sends an unlock link to the user email
|
@@ -127,20 +124,20 @@ Devise.setup do |config|
|
|
127
124
|
# ==> Configuration for :recoverable
|
128
125
|
#
|
129
126
|
# Defines which key will be used when recovering the password for an account
|
130
|
-
# config.reset_password_keys = [
|
127
|
+
# config.reset_password_keys = [:email]
|
131
128
|
|
132
129
|
# Time interval you can reset your password with a reset password key.
|
133
130
|
# Don't put a too small interval or your users won't have the time to
|
134
131
|
# change their passwords.
|
135
132
|
config.reset_password_within = 2.hours
|
136
133
|
|
134
|
+
# When set to false, does not sign a user in automatically after their password is
|
135
|
+
# reset. Defaults to true, so a user is signed in automatically after a reset.
|
136
|
+
# config.sign_in_after_reset_password = true
|
137
|
+
|
137
138
|
# Setup a pepper to generate the encrypted password.
|
138
139
|
config.pepper = "d142367154e5beacca404b1a6a4f8bc52c6fdcfa3ccc3cf8eb49f3458a688ee6ac3b9fae488432a3bfca863b8a90008368a9f3a3dfbe5a962e64b6ab8f3a3a1a"
|
139
140
|
|
140
|
-
# ==> Configuration for :token_authenticatable
|
141
|
-
# Defines name of the authentication token params key
|
142
|
-
# config.token_authentication_key = :auth_token
|
143
|
-
|
144
141
|
# ==> Scopes configuration
|
145
142
|
# Turn scoped views on. Before rendering "sessions/new", it will first check for
|
146
143
|
# "users/sessions/new". It's turned off by default because it's slower if you
|
@@ -4,7 +4,7 @@ module SharedUser
|
|
4
4
|
included do
|
5
5
|
devise :database_authenticatable, :confirmable, :lockable, :recoverable,
|
6
6
|
:registerable, :rememberable, :timeoutable,
|
7
|
-
:trackable, :validatable, :omniauthable, password_length: 7..
|
7
|
+
:trackable, :validatable, :omniauthable, password_length: 7..72
|
8
8
|
|
9
9
|
attr_accessor :other_key
|
10
10
|
|
data/test/rails_test.rb
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class RailsTest < ActiveSupport::TestCase
|
4
|
+
test 'correct initializer position' do
|
5
|
+
initializer = Devise::Engine.initializers.detect { |i| i.name == 'devise.omniauth' }
|
6
|
+
assert_equal :load_config_initializers, initializer.after
|
7
|
+
assert_equal :build_middleware_stack, initializer.before
|
8
|
+
end
|
9
|
+
end
|
data/test/support/integration.rb
CHANGED
@@ -15,7 +15,7 @@ class ActionDispatch::IntegrationTest
|
|
15
15
|
created_at: Time.now.utc
|
16
16
|
)
|
17
17
|
user.update_attribute(:confirmation_sent_at, options[:confirmation_sent_at]) if options[:confirmation_sent_at]
|
18
|
-
user.confirm
|
18
|
+
user.confirm unless options[:confirm] == false
|
19
19
|
user.lock_access! if options[:locked] == true
|
20
20
|
user
|
21
21
|
end
|
@@ -28,7 +28,7 @@ class ActionDispatch::IntegrationTest
|
|
28
28
|
password: '123456', password_confirmation: '123456',
|
29
29
|
active: options[:active]
|
30
30
|
)
|
31
|
-
admin.confirm
|
31
|
+
admin.confirm unless options[:confirm] == false
|
32
32
|
admin
|
33
33
|
end
|
34
34
|
end
|
data/test/test_helpers_test.rb
CHANGED
@@ -34,7 +34,7 @@ class TestHelpersTest < ActionController::TestCase
|
|
34
34
|
|
35
35
|
test "does not redirect with valid user" do
|
36
36
|
user = create_user
|
37
|
-
user.confirm
|
37
|
+
user.confirm
|
38
38
|
|
39
39
|
sign_in user
|
40
40
|
get :index
|
@@ -46,7 +46,7 @@ class TestHelpersTest < ActionController::TestCase
|
|
46
46
|
assert_response :redirect
|
47
47
|
|
48
48
|
user = create_user
|
49
|
-
user.confirm
|
49
|
+
user.confirm
|
50
50
|
|
51
51
|
sign_in user
|
52
52
|
get :index
|
@@ -55,7 +55,7 @@ class TestHelpersTest < ActionController::TestCase
|
|
55
55
|
|
56
56
|
test "redirects if valid user signed out" do
|
57
57
|
user = create_user
|
58
|
-
user.confirm
|
58
|
+
user.confirm
|
59
59
|
|
60
60
|
sign_in user
|
61
61
|
get :index
|
@@ -105,7 +105,7 @@ class TestHelpersTest < ActionController::TestCase
|
|
105
105
|
end
|
106
106
|
|
107
107
|
user = create_user
|
108
|
-
user.confirm
|
108
|
+
user.confirm
|
109
109
|
sign_in user
|
110
110
|
ensure
|
111
111
|
Warden::Manager._after_set_user.pop
|
@@ -118,7 +118,7 @@ class TestHelpersTest < ActionController::TestCase
|
|
118
118
|
flunk "callback was called while it should not"
|
119
119
|
end
|
120
120
|
user = create_user
|
121
|
-
user.confirm
|
121
|
+
user.confirm
|
122
122
|
|
123
123
|
sign_in user
|
124
124
|
sign_out user
|
@@ -146,7 +146,7 @@ class TestHelpersTest < ActionController::TestCase
|
|
146
146
|
|
147
147
|
test "allows to sign in with different users" do
|
148
148
|
first_user = create_user
|
149
|
-
first_user.confirm
|
149
|
+
first_user.confirm
|
150
150
|
|
151
151
|
sign_in first_user
|
152
152
|
get :index
|
@@ -154,10 +154,25 @@ class TestHelpersTest < ActionController::TestCase
|
|
154
154
|
sign_out first_user
|
155
155
|
|
156
156
|
second_user = create_user
|
157
|
-
second_user.confirm
|
157
|
+
second_user.confirm
|
158
158
|
|
159
159
|
sign_in second_user
|
160
160
|
get :index
|
161
161
|
assert_match /User ##{second_user.id}/, @response.body
|
162
162
|
end
|
163
|
+
|
164
|
+
test "creates a new warden proxy if the request object has changed" do
|
165
|
+
old_warden_proxy = warden
|
166
|
+
@request = ActionController::TestRequest.new
|
167
|
+
new_warden_proxy = warden
|
168
|
+
|
169
|
+
assert_not_equal old_warden_proxy, new_warden_proxy
|
170
|
+
end
|
171
|
+
|
172
|
+
test "doesn't create a new warden proxy if the request object hasn't changed" do
|
173
|
+
old_warden_proxy = warden
|
174
|
+
new_warden_proxy = warden
|
175
|
+
|
176
|
+
assert_equal old_warden_proxy, new_warden_proxy
|
177
|
+
end
|
163
178
|
end
|
data/test/test_models.rb
CHANGED
@@ -20,8 +20,8 @@ class UserWithCustomEncryption < User
|
|
20
20
|
end
|
21
21
|
|
22
22
|
class UserWithVirtualAttributes < User
|
23
|
-
devise case_insensitive_keys: [
|
24
|
-
validates :email, presence: true, confirmation: {on: :create}
|
23
|
+
devise case_insensitive_keys: [:email, :email_confirmation]
|
24
|
+
validates :email, presence: true, confirmation: { on: :create }
|
25
25
|
end
|
26
26
|
|
27
27
|
class Several < Admin
|
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.
|
4
|
+
version: 3.5.1
|
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:
|
12
|
+
date: 2015-05-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: warden
|
@@ -146,6 +146,8 @@ files:
|
|
146
146
|
- gemfiles/Gemfile.rails-4.0-stable.lock
|
147
147
|
- gemfiles/Gemfile.rails-4.1-stable
|
148
148
|
- gemfiles/Gemfile.rails-4.1-stable.lock
|
149
|
+
- gemfiles/Gemfile.rails-4.2-stable
|
150
|
+
- gemfiles/Gemfile.rails-4.2-stable.lock
|
149
151
|
- lib/devise.rb
|
150
152
|
- lib/devise/controllers/helpers.rb
|
151
153
|
- lib/devise/controllers/rememberable.rb
|
@@ -154,6 +156,7 @@ files:
|
|
154
156
|
- lib/devise/controllers/store_location.rb
|
155
157
|
- lib/devise/controllers/url_helpers.rb
|
156
158
|
- lib/devise/delegator.rb
|
159
|
+
- lib/devise/encryptor.rb
|
157
160
|
- lib/devise/failure_app.rb
|
158
161
|
- lib/devise/hooks/activatable.rb
|
159
162
|
- lib/devise/hooks/csrf_cleaner.rb
|
@@ -229,7 +232,9 @@ files:
|
|
229
232
|
- test/controllers/custom_registrations_controller_test.rb
|
230
233
|
- test/controllers/custom_strategy_test.rb
|
231
234
|
- test/controllers/helpers_test.rb
|
235
|
+
- test/controllers/inherited_controller_i18n_messages_test.rb
|
232
236
|
- test/controllers/internal_helpers_test.rb
|
237
|
+
- test/controllers/load_hooks_controller_test.rb
|
233
238
|
- test/controllers/passwords_controller_test.rb
|
234
239
|
- test/controllers/sessions_controller_test.rb
|
235
240
|
- test/controllers/url_helpers_test.rb
|
@@ -339,6 +344,7 @@ files:
|
|
339
344
|
- test/rails_app/public/422.html
|
340
345
|
- test/rails_app/public/500.html
|
341
346
|
- test/rails_app/public/favicon.ico
|
347
|
+
- test/rails_test.rb
|
342
348
|
- test/routes_test.rb
|
343
349
|
- test/support/action_controller/record_identifier.rb
|
344
350
|
- test/support/assertions.rb
|
@@ -378,7 +384,9 @@ test_files:
|
|
378
384
|
- test/controllers/custom_registrations_controller_test.rb
|
379
385
|
- test/controllers/custom_strategy_test.rb
|
380
386
|
- test/controllers/helpers_test.rb
|
387
|
+
- test/controllers/inherited_controller_i18n_messages_test.rb
|
381
388
|
- test/controllers/internal_helpers_test.rb
|
389
|
+
- test/controllers/load_hooks_controller_test.rb
|
382
390
|
- test/controllers/passwords_controller_test.rb
|
383
391
|
- test/controllers/sessions_controller_test.rb
|
384
392
|
- test/controllers/url_helpers_test.rb
|
@@ -488,6 +496,7 @@ test_files:
|
|
488
496
|
- test/rails_app/public/422.html
|
489
497
|
- test/rails_app/public/500.html
|
490
498
|
- test/rails_app/public/favicon.ico
|
499
|
+
- test/rails_test.rb
|
491
500
|
- test/routes_test.rb
|
492
501
|
- test/support/action_controller/record_identifier.rb
|
493
502
|
- test/support/assertions.rb
|