Sha256: a6de45c5eba07754b873a106b57d2b95cc83f62e259b900fe37346885741499d

Contents?: true

Size: 1.02 KB

Versions: 7

Compression:

Stored size: 1.02 KB

Contents

# encoding: utf-8
# 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

7 entries across 7 versions & 1 rubygems

Version Path
decidim-core-0.1.0 lib/decidim/devise_failure_app.rb
decidim-core-0.0.8.1 lib/decidim/devise_failure_app.rb
decidim-core-0.0.7 lib/decidim/devise_failure_app.rb
decidim-core-0.0.6 lib/decidim/devise_failure_app.rb
decidim-core-0.0.5 lib/decidim/devise_failure_app.rb
decidim-core-0.0.3 lib/decidim/devise_failure_app.rb
decidim-core-0.0.2 lib/decidim/devise_failure_app.rb