Class: Empower::OmniauthCallbacksController

Inherits:
EmpowerController
  • Object
show all
Defined in:
app/controllers/empower/omniauth_callbacks_controller.rb

Instance Method Summary collapse

Instance Method Details

#facebookObject



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

def facebook
  @user = User.from_omniauth(request.env["omniauth.auth"])

  if @user.persisted?
     @user #this will throw if @user is not activated
    redirect_to (@user)
  else
    session["devise.facebook_data"] = request.env["omniauth.auth"]
    redirect_to (@user)
  end
end

#failureObject



17
18
19
20
21
22
# File 'app/controllers/empower/omniauth_callbacks_controller.rb', line 17

def failure
  redirect_to(
    (session[:redirect] || main_app.root_path),
    :alert => "Could not authenticate your request."
  )
end