Sha256: 6f681ac5b489ecb844b1037d9bdef71351720ab41477a958c4f4f488e68f4fc3

Contents?: true

Size: 1.15 KB

Versions: 9

Compression:

Stored size: 1.15 KB

Contents

class Devise::OmniauthCallbacksController < DeviseController
  prepend_before_action { request.env["devise.skip_timeout"] = true }

  def passthru
    render status: 404, text: "Not found. Authentication passthru."
  end

  def failure
    set_flash_message :alert, :failure, kind: OmniAuth::Utils.camelize(failed_strategy.name), reason: failure_message
    redirect_to after_omniauth_failure_path_for(resource_name)
  end

  protected

  def failed_strategy
    request.respond_to?(:get_header) ? request.get_header("omniauth.error.strategy") : env["omniauth.error.strategy"]
  end

  def failure_message
    exception = request.respond_to?(:get_header) ? request.get_header("omniauth.error") : env["omniauth.error"]
    error   = exception.error_reason if exception.respond_to?(:error_reason)
    error ||= exception.error        if exception.respond_to?(:error)
    error ||= (request.respond_to?(:get_header) ? request.get_header("omniauth.error.type") : env["omniauth.error.type"]).to_s
    error.to_s.humanize if error
  end

  def after_omniauth_failure_path_for(scope)
    new_session_path(scope)
  end

  def translation_scope
    'devise.omniauth_callbacks'
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
devise-4.0.3 app/controllers/devise/omniauth_callbacks_controller.rb
devise-4.1.1 app/controllers/devise/omniauth_callbacks_controller.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/devise-4.1.0/app/controllers/devise/omniauth_callbacks_controller.rb
devise-4.1.0 app/controllers/devise/omniauth_callbacks_controller.rb
devise-4.0.2 app/controllers/devise/omniauth_callbacks_controller.rb
devise-4.0.1 app/controllers/devise/omniauth_callbacks_controller.rb
devise-4.0.0 app/controllers/devise/omniauth_callbacks_controller.rb
devise-4.0.0.rc2 app/controllers/devise/omniauth_callbacks_controller.rb
devise-4.0.0.rc1 app/controllers/devise/omniauth_callbacks_controller.rb