Class: Carnival::OmniauthCallbacksController
- Inherits:
-
Devise::OmniauthCallbacksController
- Object
- Devise::OmniauthCallbacksController
- Carnival::OmniauthCallbacksController
- Defined in:
- app/controllers/carnival/omniauth_callbacks_controller.rb
Instance Method Summary collapse
Instance Method Details
#facebook ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 |
# File 'app/controllers/carnival/omniauth_callbacks_controller.rb', line 2 def facebook # You need to implement the method below in your model (e.g. app/models/user.rb) @user = Carnival::AdminUser.find_for_omni_auth(request.env["omniauth.auth"]) if @user.persisted? sign_in_and_redirect @user, :event => :authentication #this will throw if @user is not activated (:notice, :success, :kind => "Facebook") if else session["devise.facebook_data"] = request.env["omniauth.auth"] redirect_to new_user_registration_url end end |
#google_oauth2 ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/controllers/carnival/omniauth_callbacks_controller.rb', line 15 def google_oauth2 user = Carnival::AdminUser.find_for_omni_auth(request.env["omniauth.auth"]) if user.persisted? flash.notice = "Signed in Through Google!" sign_in_and_redirect user else session["devise.user_attributes"] = user.attributes flash.notice = "You are almost Done! Please provide a password to finish setting up your account" redirect_to new_user_registration_url end end |