Sha256: 854b3e168ba7766b49c989aea6d9bda00d2e6137aec39878b3e6dcff023dad64

Contents?: true

Size: 1.01 KB

Versions: 4

Compression:

Stored size: 1.01 KB

Contents

# frozen_string_literal: true

module Decidim
  # We've provided a custom class in order to be able to deactivate the
  # script_name hack that doesn't seem to be affecting us (it is actually
  # introducing a bug).
  class DeviseFailureApp < ::Devise::FailureApp
    def scope_url
      opts  = {}

      # Initialize script_name with nil to prevent infinite loops in
      # authenticated mounted engines in rails 4.2 and 5.0

      # The line below is what we commented LOL ^^
      # opts[:script_name] = nil

      route = route(scope)

      opts[:locale] = params[:locale] if params[:locale]
      opts[:format] = request_format unless skip_format?

      opts[:script_name] = relative_url_root if relative_url_root?

      router_name = ::Devise.mappings[scope].router_name || ::Devise.available_router_name
      context = send(router_name)

      if context.respond_to?(route)
        context.send(route, opts)
      elsif respond_to?(:root_url)
        root_url(opts)
      else
        "/"
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
decidim-core-0.3.2 lib/decidim/devise_failure_app.rb
decidim-core-0.3.1 lib/decidim/devise_failure_app.rb
decidim-core-0.3.0 lib/decidim/devise_failure_app.rb
decidim-core-0.2.0 lib/decidim/devise_failure_app.rb