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
2018-12-04 07:41:01 +05:00

39 lines
955 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 # rubocop:disable Metrics/AbcSize
auth = request.env['omniauth.auth']
users = User.where omniauth_provider: auth.provider, omniauth_uid: auth.uid
user = users.first_or_create do |new_user|
new_user.provider = auth.provider
new_user.uid = auth.uid
new_user.email = auth.info.email
new_user.password = Devise.friendly_token[0, 20]
end
sign_in_and_redirect user
end
# protected
# The path used when OmniAuth fails
# def after_omniauth_failure_path_for(scope)
# super(scope)
# end
end