Skip to content

Commit

Permalink
Properly ignore path prefix on omniauthable
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim committed Mar 14, 2011
1 parent d58a72e commit 1bf7da1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.rdoc
@@ -1,3 +1,6 @@
* bug fix
* Properly ignore path prefix on omniauthable

== 1.2.rc2

* enhancements
Expand Down
5 changes: 4 additions & 1 deletion lib/devise/rails/routes.rb
Expand Up @@ -263,6 +263,7 @@ def devise_registration(mapping, controllers) #:nodoc:
end

def devise_omniauth_callback(mapping, controllers) #:nodoc:
path, @scope[:path] = @scope[:path], nil
path_prefix = "/#{mapping.path}/auth"

if ::OmniAuth.config.path_prefix && ::OmniAuth.config.path_prefix != path_prefix
Expand All @@ -271,8 +272,10 @@ def devise_omniauth_callback(mapping, controllers) #:nodoc:
::OmniAuth.config.path_prefix = path_prefix
end

match "/auth/:action/callback", :action => Regexp.union(mapping.to.omniauth_providers.map(&:to_s)),
match "#{path_prefix}/:action/callback", :action => Regexp.union(mapping.to.omniauth_providers.map(&:to_s)),
:to => controllers[:omniauth_callbacks], :as => :omniauth_callback
ensure
@scope[:path] = path
end

def with_devise_exclusive_scope(new_path, new_as) #:nodoc:
Expand Down

0 comments on commit 1bf7da1

Please sign in to comment.