Class: Users::OmniauthCallbacksController
- Inherits:
-
Devise::OmniauthCallbacksController
- Object
- Devise::OmniauthCallbacksController
- Users::OmniauthCallbacksController
- Defined in:
- lib/generators/polivalente/templates/omniauth_controller.rb
Instance Method Summary collapse
- #all ⇒ Object (also: #github, #twitter)
- #failure ⇒ Object
Instance Method Details
#all ⇒ Object 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!" sign_in_and_redirect user else session["devise.user_attributes"] = user.attributes redirect_to new_user_registration_url end end |
#failure ⇒ Object
22 23 24 |
# File 'lib/generators/polivalente/templates/omniauth_controller.rb', line 22 def failure redirect_to main_app.root_path end |