mirror of
https://github.com/heartcombo/devise.git
synced 2022-11-09 12:18:31 -05:00
Deprecate legacy OmniAuth URL helpers.
This commit is contained in:
parent
76f76249e7
commit
5b1182460c
1 changed files with 58 additions and 0 deletions
|
@ -2,6 +2,54 @@ module Devise
|
|||
module OmniAuth
|
||||
module UrlHelpers
|
||||
def self.define_helpers(mapping)
|
||||
return unless mapping.omniauthable?
|
||||
|
||||
mapping = mapping.name
|
||||
|
||||
class_eval do
|
||||
define_method("#{mapping}_omniauth_authorize_path") do |provider, *args|
|
||||
ActiveSupport::Deprecation.warn(<<-DEPRECATION.strip_heredoc)
|
||||
[Devise] #{mapping}_omniauth_authorize_path(#{provider.inspect}) is deprecated and it will be removed from Devise 4.1.
|
||||
|
||||
Please use #{mapping}_#{provider}_omniauth_authorize_path instead.
|
||||
DEPRECATION
|
||||
send("#{mapping}_#{provider}_omniauth_authorize_path", *args)
|
||||
end
|
||||
|
||||
define_method("#{mapping}_omniauth_authorize_url") do |provider, *args|
|
||||
ActiveSupport::Deprecation.warn(<<-DEPRECATION.strip_heredoc)
|
||||
[Devise] #{mapping}_omniauth_authorize_url(#{provider.inspect}) is deprecated and it will be removed from Devise 4.1.
|
||||
|
||||
Please use #{mapping}_#{provider}_omniauth_authorize_url instead.
|
||||
DEPRECATION
|
||||
send("#{mapping}_#{provider}_omniauth_authorize_url", *args)
|
||||
end
|
||||
|
||||
define_method("#{mapping}_omniauth_callback_path") do |provider, *args|
|
||||
ActiveSupport::Deprecation.warn(<<-DEPRECATION.strip_heredoc)
|
||||
[Devise] #{mapping}_omniauth_callback_path(#{provider.inspect}) is deprecated and it will be removed from Devise 4.1.
|
||||
|
||||
Please use #{mapping}_#{provider}_omniauth_callback_path instead.
|
||||
DEPRECATION
|
||||
send("#{mapping}_#{provider}_omniauth_callback_path", *args)
|
||||
end
|
||||
|
||||
define_method("#{mapping}_omniauth_callback_url") do |provider, *args|
|
||||
ActiveSupport::Deprecation.warn(<<-DEPRECATION.strip_heredoc)
|
||||
[Devise] #{mapping}_omniauth_callback_url(#{provider.inspect}) is deprecated and it will be removed from Devise 4.1.
|
||||
|
||||
Please use #{mapping}_#{provider}_omniauth_callback_url instead.
|
||||
DEPRECATION
|
||||
send("#{mapping}_#{provider}_omniauth_callback_url", *args)
|
||||
end
|
||||
end
|
||||
|
||||
ActiveSupport.on_load(:action_controller) do
|
||||
if respond_to?(:helper_method)
|
||||
helper_method "#{mapping}_omniauth_authorize_path", "#{mapping}_omniauth_authorize_url"
|
||||
helper_method "#{mapping}_omniauth_callback_path", "#{mapping}_omniauth_callback_url"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def omniauth_authorize_path(resource_or_scope, provider, *args)
|
||||
|
@ -9,10 +57,20 @@ module Devise
|
|||
_devise_route_context.send("#{scope}_#{provider}_omniauth_authorize_path", *args)
|
||||
end
|
||||
|
||||
def omniauth_authorize_url(resource_or_scope, provider, *args)
|
||||
scope = Devise::Mapping.find_scope!(resource_or_scope)
|
||||
_devise_route_context.send("#{scope}_#{provider}_omniauth_authorize_url", *args)
|
||||
end
|
||||
|
||||
def omniauth_callback_path(resource_or_scope, provider, *args)
|
||||
scope = Devise::Mapping.find_scope!(resource_or_scope)
|
||||
_devise_route_context.send("#{scope}_#{provider}_omniauth_callback_path", *args)
|
||||
end
|
||||
|
||||
def omniauth_callback_url(resource_or_scope, provider, *args)
|
||||
scope = Devise::Mapping.find_scope!(resource_or_scope)
|
||||
_devise_route_context.send("#{scope}_#{provider}_omniauth_callback_url", *args)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue