omniauth_callbacks_controller.rb 396 B

123456789101112131415161718192021
  1. # frozen_string_literal: true
  2. class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
  3. def all
  4. user = User.from_omniauth(request.env['omniauth.auth'], current_user)
  5. if user.persisted?
  6. sign_in_and_redirect(user)
  7. else
  8. redirect_to root_path
  9. end
  10. end
  11. alias twitter all
  12. alias mastodon all
  13. def failure
  14. redirect_to root_path
  15. end
  16. end