Skip to content

Commit

Permalink
fix error text bug
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoMcA authored and jfromaniello committed May 5, 2017
1 parent 179a2ce commit d23a6fe
Showing 1 changed file with 0 additions and 16 deletions.
16 changes: 0 additions & 16 deletions plugin.rb
Expand Up @@ -45,22 +45,6 @@ def after_authenticate(auth_token)
end

def register_middleware(omniauth)
#Override OmniAuth on_failure in order to include error_description on redirect.
OmniAuth.config.on_failure = Proc.new { |env|
message_key = env['omniauth.error.type']
error_description = Rack::Utils.escape(env['omniauth.error'].error_reason)
new_path = "#{env['SCRIPT_NAME']}#{OmniAuth.config.path_prefix}/failure?message=#{message_key}&error_description=#{error_description}"
Rack::Response.new(['302 Moved'], 302, 'Location' => new_path).finish
}

#Override OmniauthCallbacksController.failure in order to show error_description
Users::OmniauthCallbacksController.class_eval do
def failure
flash[:error] = params[:error_description] || I18n.t("login.omniauth_error")
render layout: 'no_ember'
end
end

omniauth.provider :auth0,
:setup => lambda { |env|
strategy = env["omniauth.strategy"]
Expand Down

0 comments on commit d23a6fe

Please sign in to comment.