1
0
Fork 0
This repository has been archived on 2023-03-27. You can view files and clone it, but cannot push or open issues or pull requests.
lpr-partynest/app/controllers/users/omniauth_callbacks_controller.rb
2019-04-28 18:34:46 +05:00

38 lines
764 B
Ruby

# frozen_string_literal: true
class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
skip_after_action :verify_authorized
skip_after_action :verify_policy_scoped
# GET|POST /resource/auth/:provider
def passthru
super
end
# GET|POST /users/auth/:provider/callback
def failure
super
end
# GET|POST /users/auth/github/callback
def github
context = AuthenticateUserWithOmniauth.call(
provider: auth_hash.provider,
remote_id: auth_hash.uid,
email: auth_hash.info.email,
)
sign_in_and_redirect context.user
end
private
def auth_hash
request.env['omniauth.auth']
end
# The path used when OmniAuth fails
def after_omniauth_failure_path_for(_scope)
super
end
end