Sha256: a46edbc85d1aec1adedbc6d97dedaa083efa3b5f43172ea4265da9c100dcddda
Contents?: true
Size: 1.21 KB
Versions: 2
Compression:
Stored size: 1.21 KB
Contents
# frozen_string_literal: true class Kingsman::OmniauthCallbacksController < KingsmanController prepend_before_action { request.env["kingsman.skip_timeout"] = true } def passthru render status: 404, plain: "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") : request.env["omniauth.error.strategy"] end def failure_message exception = request.respond_to?(:get_header) ? request.get_header("omniauth.error") : request.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") : request.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 'kingsman.omniauth_callbacks' end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
kingsman-0.1.1 | app/controllers/kingsman/omniauth_callbacks_controller.rb |
kingsman-0.1.0 | app/controllers/kingsman/omniauth_callbacks_controller.rb |