mirror of
https://github.com/heartcombo/devise.git
synced 2022-11-09 12:18:31 -05:00
Adding option to change omniauth path prefix
This commit is contained in:
parent
5df7105301
commit
512b52e23a
2 changed files with 6 additions and 1 deletions
|
@ -199,6 +199,11 @@ module Devise
|
||||||
# to provide custom routes.
|
# to provide custom routes.
|
||||||
mattr_accessor :router_name
|
mattr_accessor :router_name
|
||||||
@@router_name = nil
|
@@router_name = nil
|
||||||
|
|
||||||
|
# Set the omniauth path prefix so it can be overriden when
|
||||||
|
# Devise is used in a mountable engine
|
||||||
|
mattr_accessor :omniauth_path_prefix
|
||||||
|
@@omniauth_path_prefix = nil
|
||||||
|
|
||||||
def self.encryptor=(value)
|
def self.encryptor=(value)
|
||||||
warn "\n[DEVISE] To select a encryption which isn't bcrypt, you should use devise-encryptable gem.\n"
|
warn "\n[DEVISE] To select a encryption which isn't bcrypt, you should use devise-encryptable gem.\n"
|
||||||
|
|
|
@ -382,7 +382,7 @@ module ActionDispatch::Routing
|
||||||
|
|
||||||
def devise_omniauth_callback(mapping, controllers) #:nodoc:
|
def devise_omniauth_callback(mapping, controllers) #:nodoc:
|
||||||
path, @scope[:path] = @scope[:path], nil
|
path, @scope[:path] = @scope[:path], nil
|
||||||
path_prefix = "/#{mapping.path}/auth".squeeze("/")
|
path_prefix = Devise.omniauth_path_prefix || "/#{mapping.path}/auth".squeeze("/")
|
||||||
set_omniauth_path_prefix!(path_prefix)
|
set_omniauth_path_prefix!(path_prefix)
|
||||||
|
|
||||||
match "#{path_prefix}/:action/callback", :constraints => { :action => Regexp.union(mapping.to.omniauth_providers.map(&:to_s)) },
|
match "#{path_prefix}/:action/callback", :constraints => { :action => Regexp.union(mapping.to.omniauth_providers.map(&:to_s)) },
|
||||||
|
|
Loading…
Reference in a new issue