Class: Users::OmniauthCallbacksController

Inherits:
Devise::OmniauthCallbacksController
  • Object
show all
Defined in:
lib/generators/polivalente/templates/omniauth_controller.rb

Instance Method Summary collapse

Instance Method Details

#allObject Also known as: github, twitter



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/generators/polivalente/templates/omniauth_controller.rb', line 4

def all
  user_class = Polivalente.config.user_class.constantize

  raise request.env["omniauth.auth"].to_yaml

  user = user_class.from_omniauth(request.env["omniauth.auth"])

  if user.persisted?
    flash.notice = "Signed in!"
     user
  else
    session["devise.user_attributes"] = user.attributes
    redirect_to new_user_registration_url
  end
end

#failureObject



22
23
24
# File 'lib/generators/polivalente/templates/omniauth_controller.rb', line 22

def failure
  redirect_to main_app.root_path
end