mirror of
https://github.com/omniauth/omniauth.git
synced 2022-11-09 12:31:49 -05:00
Make the FailureEndpoint respect the strategy's path_prefix.
Previously, it just fetched the global path_prefix.
This commit is contained in:
parent
894cb9c2f6
commit
eb5047ad51
2 changed files with 16 additions and 2 deletions
|
@ -27,10 +27,18 @@ module OmniAuth
|
|||
|
||||
def redirect_to_failure
|
||||
message_key = env['omniauth.error.type']
|
||||
new_path = "#{env['SCRIPT_NAME']}#{OmniAuth.config.path_prefix}/failure?message=#{message_key}#{origin_query_param}#{strategy_name_query_param}"
|
||||
new_path = "#{env['SCRIPT_NAME']}#{strategy_path_prefix}/failure?message=#{message_key}#{origin_query_param}#{strategy_name_query_param}"
|
||||
Rack::Response.new(['302 Moved'], 302, 'Location' => new_path).finish
|
||||
end
|
||||
|
||||
def strategy_path_prefix
|
||||
if env['omniauth.error.strategy']
|
||||
env['omniauth.error.strategy'].path_prefix
|
||||
else
|
||||
OmniAuth.config.path_prefix
|
||||
end
|
||||
end
|
||||
|
||||
def strategy_name_query_param
|
||||
return '' unless env['omniauth.error.strategy']
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue