mirror of
https://github.com/heartcombo/devise.git
synced 2026-01-10 07:18:14 -05:00
omniauth route should not add a ? if no param is given
This commit is contained in:
committed by
José Valim
parent
bf19b15914
commit
09a46695f2
@@ -7,7 +7,7 @@ module Devise
|
||||
class_eval <<-URL_HELPERS, __FILE__, __LINE__ + 1
|
||||
def #{mapping.name}_omniauth_authorize_path(provider, params = {})
|
||||
if Devise.omniauth_configs[provider.to_sym]
|
||||
"/#{mapping.path}/auth/\#{provider}?\#{params.to_param}"
|
||||
"/#{mapping.path}/auth/\#{provider}\#{'?'+params.to_param if params.present?}"
|
||||
else
|
||||
raise ArgumentError, "Could not find omniauth provider \#{provider.inspect}"
|
||||
end
|
||||
|
||||
@@ -36,7 +36,12 @@ class OmniAuthRoutesTest < ActionController::TestCase
|
||||
end
|
||||
|
||||
test 'should generate authorization path with params' do
|
||||
assert_match "/users/auth/open_id?openid_url=http%3A%2F%2Fyahoo.com",
|
||||
assert_match "/users/auth/open_id?openid_url=http%3A%2F%2Fyahoo.com",
|
||||
@controller.omniauth_authorize_path(:user, :open_id, :openid_url => "http://yahoo.com")
|
||||
end
|
||||
|
||||
test 'should not add a "?" if no param was sent' do
|
||||
assert_equal "/users/auth/open_id",
|
||||
@controller.omniauth_authorize_path(:user, :open_id)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user