mirror of
https://github.com/heartcombo/devise.git
synced 2022-11-09 12:18:31 -05:00
Replace log_process_action to append_info_to_payload
This commit is contained in:
parent
8a4d610c58
commit
9caae50339
2 changed files with 17 additions and 5 deletions
|
@ -10,6 +10,11 @@ module Devise
|
|||
if respond_to?(:helper_method)
|
||||
helper_method :warden, :signed_in?, :devise_controller?
|
||||
end
|
||||
|
||||
def append_info_to_payload(payload)
|
||||
super
|
||||
payload[:status] ||= 401 unless payload[:exception]
|
||||
end
|
||||
end
|
||||
|
||||
module ClassMethods
|
||||
|
@ -76,11 +81,6 @@ module Devise
|
|||
end
|
||||
METHODS
|
||||
end
|
||||
|
||||
def log_process_action(payload)
|
||||
payload[:status] ||= 401 unless payload[:exception]
|
||||
super
|
||||
end
|
||||
end
|
||||
|
||||
# Define authentication filters and accessor helpers based on mappings.
|
||||
|
|
|
@ -543,6 +543,18 @@ class AuthenticationOthersTest < Devise::IntegrationTest
|
|||
refute warden.authenticated?(:user)
|
||||
end
|
||||
end
|
||||
|
||||
test 'not signed in should returns notification payload with 401 status' do
|
||||
begin
|
||||
subscriber = ActiveSupport::Notifications.subscribe /process_action.action_controller/ do |_name, _start, _finish, _id, payload|
|
||||
assert_equal 401, payload[:status]
|
||||
end
|
||||
|
||||
get admins_path
|
||||
ensure
|
||||
ActiveSupport::Notifications.unsubscribe(subscriber)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class AuthenticationKeysTest < Devise::IntegrationTest
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue