Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Not update cookies when is a batch request #1577

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ def refresh_headers
# update the response header
response.headers.merge!(_auth_header_from_batch_request)

# set a server cookie if configured
if DeviseTokenAuth.cookie_enabled
# set a server cookie if configured and is not a batch request
if DeviseTokenAuth.cookie_enabled && !@is_batch_request
set_cookie(_auth_header_from_batch_request)
end
end # end lock
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def show
redirect_to_link = signed_in_resource.build_auth_url(redirect_url, redirect_headers)
else
redirect_to_link = DeviseTokenAuth::Url.generate(redirect_url, redirect_header_options)
end
end

redirect_to(redirect_to_link)
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,12 @@ def token_and_client_config_from(body)

describe 'failure' do
test 'user should not be confirmed' do
assert_raises(ActionController::RoutingError) do
get :show, params: { confirmation_token: 'bogus' }
end
get :show,
params: { confirmation_token: 'bogus',
redirect_url: @redirect_url }

assert_redirected_to(/^#{@redirect_url}/)

@resource = assigns(:resource)
refute @resource.confirmed?
end
Expand Down