Class: Omnisand::OmniauthCallbacksController

Inherits:
Devise::OmniauthCallbacksController
  • Object
show all
Defined in:
app/controllers/omnisand/omniauth_callbacks_controller.rb

Instance Method Summary collapse

Instance Method Details

#callbackObject



3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'app/controllers/omnisand/omniauth_callbacks_controller.rb', line 3

def callback
  omniauth = request.env['omniauth.auth']
  @authentication = Authentication.find_by_provider_and_uid(omniauth['provider'], omniauth['uid'])
  if @authentication
    @user = @authentication.user
  else
    # New User
    @user = User.new
  end
  @user.set_params omniauth
  (:user, @user)
  redirect_to '/'
end