Class: Users::OmniauthCallbacksController
- Inherits:
-
Devise::OmniauthCallbacksController
- Object
- Devise::OmniauthCallbacksController
- Users::OmniauthCallbacksController
- Defined in:
- lib/generators/boring/oauth/facebook/install/templates/omniauth_callbacks_controller.rb,
lib/generators/boring/oauth/twitter/install/templates/omniauth_callbacks_controller.rb,
lib/generators/boring/oauth/google/install/templates/omniauth_callbacks_controller.rb,
lib/generators/boring/oauth/github/install/templates/omniauth_callbacks_controller.rb
Instance Method Summary collapse
Instance Method Details
#facebook ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/generators/boring/oauth/facebook/install/templates/omniauth_callbacks_controller.rb', line 5 def facebook # You need to implement the method below in your model (e.g. app/models/user.rb) @user = User.from_omniauth(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"].except(:extra) # Removing extra as it can overflow some session stores redirect_to new_user_registration_url end end |
#failure ⇒ Object
18 19 20 |
# File 'lib/generators/boring/oauth/facebook/install/templates/omniauth_callbacks_controller.rb', line 18 def failure redirect_to root_path end |
#github ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/generators/boring/oauth/github/install/templates/omniauth_callbacks_controller.rb', line 5 def github # You need to implement the method below in your model (e.g. app/models/user.rb) @user = User.from_omniauth(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: "GitHub") if else session["devise.github_data"] = request.env["omniauth.auth"].except(:extra) # Removing extra as it can overflow some session stores redirect_to new_user_registration_url end end |
#google_auth ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/generators/boring/oauth/google/install/templates/omniauth_callbacks_controller.rb', line 5 def google_auth # You need to implement the method below in your model (e.g. app/models/user.rb) @user = User.from_omniauth(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: "Google") if else session["devise.google_data"] = request.env["omniauth.auth"].except(:extra) # Removing extra as it can overflow some session stores redirect_to new_user_registration_url end end |
#twitter ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/generators/boring/oauth/twitter/install/templates/omniauth_callbacks_controller.rb', line 5 def twitter # You need to implement the method below in your model (e.g. app/models/user.rb) @user = User.from_omniauth(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: "Twitter") if else session["devise.twitter_data"] = request.env["omniauth.auth"].except(:extra) # Removing extra as it can overflow some session stores redirect_to new_user_registration_url end end |