mirror of
https://github.com/heartcombo/devise.git
synced 2026-01-10 07:18:14 -05:00
Set the new default for strip_whitespace_keys config
This commit is contained in:
@@ -88,19 +88,8 @@ module Devise
|
|||||||
@@case_insensitive_keys = [:email]
|
@@case_insensitive_keys = [:email]
|
||||||
|
|
||||||
# Keys that should have whitespace stripped.
|
# Keys that should have whitespace stripped.
|
||||||
# TODO: 4.1 Do: @@strip_whitespace_keys = [:email]
|
mattr_accessor :strip_whitespace_keys
|
||||||
mattr_reader :strip_whitespace_keys
|
@@strip_whitespace_keys = [:email]
|
||||||
@@strip_whitespace_keys = []
|
|
||||||
|
|
||||||
def self.strip_whitespace_keys=(strip_whitespace_keys)
|
|
||||||
app_set_configs << :strip_whitespace_keys
|
|
||||||
@@strip_whitespace_keys = strip_whitespace_keys
|
|
||||||
end
|
|
||||||
|
|
||||||
def strip_whitespace_keys=(strip_whitespace_keys)
|
|
||||||
app_set_configs << :strip_whitespace_keys
|
|
||||||
@@strip_whitespace_keys = strip_whitespace_keys
|
|
||||||
end
|
|
||||||
|
|
||||||
# If http authentication is enabled by default.
|
# If http authentication is enabled by default.
|
||||||
mattr_accessor :http_authenticatable
|
mattr_accessor :http_authenticatable
|
||||||
@@ -333,7 +322,6 @@ module Devise
|
|||||||
warn_default_config_changed(:reconfirmable, 'false', 'true')
|
warn_default_config_changed(:reconfirmable, 'false', 'true')
|
||||||
warn_default_config_changed(:sign_out_via, ':get', ':delete')
|
warn_default_config_changed(:sign_out_via, ':get', ':delete')
|
||||||
warn_default_config_changed(:skip_session_storage, '[]', '[:http_auth]')
|
warn_default_config_changed(:skip_session_storage, '[]', '[:http_auth]')
|
||||||
warn_default_config_changed(:strip_whitespace_keys, '[]', '[:email]')
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.warn_default_config_changed(config, current_default, new_default)
|
def self.warn_default_config_changed(config, current_default, new_default)
|
||||||
|
|||||||
@@ -37,11 +37,10 @@ class DeviseTest < ActiveSupport::TestCase
|
|||||||
|
|
||||||
test 'setup block warns about defaults changing' do
|
test 'setup block warns about defaults changing' do
|
||||||
Devise.app_set_configs = Set.new
|
Devise.app_set_configs = Set.new
|
||||||
|
|
||||||
ActiveSupport::Deprecation.expects(:warn).with() { |value| value =~ /reconfirmable/ }
|
ActiveSupport::Deprecation.expects(:warn).with() { |value| value =~ /reconfirmable/ }
|
||||||
ActiveSupport::Deprecation.expects(:warn).with() { |value| value =~ /sign_out_via/ }
|
ActiveSupport::Deprecation.expects(:warn).with() { |value| value =~ /sign_out_via/ }
|
||||||
ActiveSupport::Deprecation.expects(:warn).with() { |value| value =~ /skip_session_storage/ }
|
ActiveSupport::Deprecation.expects(:warn).with() { |value| value =~ /skip_session_storage/ }
|
||||||
ActiveSupport::Deprecation.expects(:warn).with() { |value| value =~ /strip_whitespace_keys/ }
|
|
||||||
|
|
||||||
Devise.setup do
|
Devise.setup do
|
||||||
end
|
end
|
||||||
@@ -53,8 +52,7 @@ class DeviseTest < ActiveSupport::TestCase
|
|||||||
swap Devise,
|
swap Devise,
|
||||||
reconfirmable: false,
|
reconfirmable: false,
|
||||||
sign_out_via: :get,
|
sign_out_via: :get,
|
||||||
skip_session_storage: [],
|
skip_session_storage: [] do
|
||||||
strip_whitespace_keys: [] do
|
|
||||||
Devise.setup do
|
Devise.setup do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user