Skip to content

Commit

Permalink
Remove local var devise_mapping; use the overridden `#devise_mappin…
Browse files Browse the repository at this point in the history
…g` instead.

Instead of re-inventing `devise_mapping`, just use the overridden method that is
inherited from `DeviseController` in the `Devise` gem. The override takes the
`omniauth_params` into account, if there are any.
  • Loading branch information
Evan-M committed Feb 13, 2018
1 parent f7fe6f8 commit 939010d
Showing 1 changed file with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ def redirect_callbacks

# derive target redirect route from 'resource_class' param, which was set
# before authentication.
devise_mapping = [request.env['omniauth.params']['namespace_name'],
request.env['omniauth.params']['resource_class'].underscore.gsub('/', '_')].compact.join('_')
path = "#{Devise.mappings[devise_mapping.to_sym].fullpath}/#{params[:provider]}/callback"
path = "#{devise_mapping.fullpath}/#{params[:provider]}/callback"
klass = request.scheme == 'https' ? URI::HTTPS : URI::HTTP
redirect_route = klass.build(host: request.host, port: request.port, path: path).to_s

Expand Down

0 comments on commit 939010d

Please sign in to comment.