17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'app/controllers/groovestack/auth/omniauth_callbacks_controller.rb', line 17
def failure
known_reasons = %w[user_cancelled_authorize user_denied]
handled = known_reasons.any? do |reason|
request.params&.dig('error_reason') == reason || request.params&.dig('error') == reason
end
if !handled && Rails.env.production?
failure_kind = OmniAuth::Utils.camelize(failed_strategy.name)
blob = {
kind: failure_kind,
reason: failure_message,
params: request.params,
omniauth: request.env['omniauth.auth']
}
exception = OmniauthFailureError.new(blob.to_s)
::Groovestack::Base.notify_error('Groovestack::Auth::OmniauthCallbacksController.omniauth_failure', exception)
end
set_flash_message! :alert, :failure, kind: failure_kind, reason: failure_message
redirect_to after_omniauth_failure_path_for(resource_name),
allow_other_host: ::Groovestack::Auth.allow_other_host_redirects
end
|