Sha256: 5e93b962c4b3d1c7874341c3622f37d852ae86e16781617835bbfdb7bdd83f6a
Contents?: true
Size: 1.43 KB
Versions: 15
Compression:
Stored size: 1.43 KB
Contents
module Rodauth module Rails module Feature module InternalRequest def domain return super unless missing_host? rails_url_options.fetch(:host) end def base_url return super unless missing_host? && domain scheme = rails_url_options[:protocol] || "http" port = rails_url_options[:port] url = "#{scheme}://#{domain}" url << ":#{port}" if port url end private def rails_controller_around return yield if internal_request? super end def rails_instrument_request return yield if internal_request? super end def rails_instrument_redirection return yield if internal_request? super end # Checks whether we're in an internal request and host was not set, # or the request doesn't exist such as with path_class_methods feature. def missing_host? internal_request? && request.host == INVALID_DOMAIN || scope.nil? end def rails_url_options ::Rails.application.config.action_mailer.default_url_options or fail Error, "There is no information to set the URL host from. Please set config.action_mailer.default_url_options in your Rails application, or configure #domain and #base_url in your Rodauth configuration." end end end end end
Version data entries
15 entries across 15 versions & 1 rubygems