Sha256: ba9d612dcbc57232bad280da5ba431c3dd9c6fecfb6c7d924f8183636d0e8965

Contents?: true

Size: 829 Bytes

Versions: 18

Compression:

Stored size: 829 Bytes

Contents

# frozen_string_literal: true

module G5Authenticatable
  # Custom failure app that generates urls correctly within an isolated engine
  # https://github.com/plataformatec/devise/issues/4127
  class FailureApp < Devise::FailureApp
    def scope_url
      opts  = {}
      route = :"new_#{scope}_session_url"
      opts[:format] = request_format unless skip_format?

      config = Rails.application.config

      if config.try(:relative_url_root)
        opts[:script_name] = config.relative_url_root
      end

      failure_url(route, opts)
    end

    private

    def failure_url(route, opts)
      context = send(Devise.available_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

18 entries across 18 versions & 1 rubygems

Version Path
g5_authenticatable-1.1.4 app/controllers/g5_authenticatable/failure_app.rb
g5_authenticatable-1.1.4.rc.3 app/controllers/g5_authenticatable/failure_app.rb
g5_authenticatable-1.1.4.rc.2 app/controllers/g5_authenticatable/failure_app.rb
g5_authenticatable-1.1.4.rc.1 app/controllers/g5_authenticatable/failure_app.rb
g5_authenticatable-1.1.2 app/controllers/g5_authenticatable/failure_app.rb
g5_authenticatable-1.1.2.pre.1 app/controllers/g5_authenticatable/failure_app.rb
g5_authenticatable-1.1.2.rc.5 app/controllers/g5_authenticatable/failure_app.rb
g5_authenticatable-1.1.2.rc.4 app/controllers/g5_authenticatable/failure_app.rb
g5_authenticatable-1.1.2.rc.3 app/controllers/g5_authenticatable/failure_app.rb
g5_authenticatable-1.1.2.rc.2 app/controllers/g5_authenticatable/failure_app.rb
g5_authenticatable-1.1.2.rc.1 app/controllers/g5_authenticatable/failure_app.rb
g5_authenticatable-1.1.1 app/controllers/g5_authenticatable/failure_app.rb
g5_authenticatable-1.1.0 app/controllers/g5_authenticatable/failure_app.rb
g5_authenticatable-1.0.0 app/controllers/g5_authenticatable/failure_app.rb
g5_authenticatable-1.0.0.pre.4 app/controllers/g5_authenticatable/failure_app.rb
g5_authenticatable-1.0.0.pre.3 app/controllers/g5_authenticatable/failure_app.rb
g5_authenticatable-1.0.0.pre.2 app/controllers/g5_authenticatable/failure_app.rb
g5_authenticatable-1.0.0.pre.1 app/controllers/g5_authenticatable/failure_app.rb