Module: DeviseTokenAuth::Url
- Defined in:
- lib/devise_token_auth/url.rb
Defined Under Namespace
Classes: Wildcat
Class Method Summary collapse
Class Method Details
.generate(url, params = {}) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/devise_token_auth/url.rb', line 3 def self.generate(url, params = {}) uri = URI(url) res = "#{uri.scheme}://#{uri.host}" res += ":#{uri.port}" if (uri.port && uri.port != 80 && uri.port != 443) res += "#{uri.path}" if uri.path query = [uri.query, params.to_query].reject(&:blank?).join('&') res += "?#{query}" res += "##{uri.fragment}" if uri.fragment return res end |
.whitelisted?(url) ⇒ Boolean
16 17 18 |
# File 'lib/devise_token_auth/url.rb', line 16 def self.whitelisted?(url) url.nil? || !!DeviseTokenAuth.redirect_whitelist.find { |pattern| !!Wildcat.new(pattern).match(url) } end |