1
0
Fork 0
mirror of https://github.com/heartcombo/devise.git synced 2022-11-09 12:18:31 -05:00
heartcombo--devise/app/controllers/devise/omniauth_callbacks_controller.rb
Vinicius Baggio 352edc024b Cleaning up test helpers related to OmniAuth.
Developers should rely on OmniAuth's new testing API. Check
https://github.com/intridea/omniauth/wiki/Integration-Testing
for more details.
2011-02-24 16:50:22 -03:00

26 lines
763 B
Ruby

class Devise::OmniauthCallbacksController < ApplicationController
include Devise::Controllers::InternalHelpers
def failure
set_flash_message :alert, :failure, :kind => failed_strategy.name.to_s.humanize, :reason => failure_message
redirect_to after_omniauth_failure_path_for(resource_name)
end
protected
def failed_strategy
env["omniauth.error.strategy"]
end
def failure_message
exception = env["omniauth.error"]
error = exception.error_reason if exception.respond_to?(:error_reason)
error ||= exception.error if exception.respond_to?(:error)
error ||= 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
end