Class: Users::OmniauthCallbacksController
- Inherits:
-
Devise::OmniauthCallbacksController
- Object
- Devise::OmniauthCallbacksController
- Users::OmniauthCallbacksController
- Defined in:
- app/controllers/users/omniauth_callbacks_controller.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#handle_unverified_request ⇒ Object
This is solution for existing accout want bind Google login but current_user is always nil github.com/intridea/omniauth/issues/185.
Class Method Details
.provides_callback_for(*providers) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/controllers/users/omniauth_callbacks_controller.rb', line 3 def self.provides_callback_for(*providers) providers.each do |provider| class_eval %Q{ def #{provider} if !current_user.blank? current_user.bind_service(env["omniauth.auth"])#Add an auth to existing redirect_to setting_path, :notice => "Bind #{provider} account successfully." else @user = User.find_or_create_for_#{provider}(env["omniauth.auth"]) if @user.persisted? # flash[:notice] = "Signed in with #{provider.to_s.titleize} successfully." sign_in_and_redirect @user, :event => :authentication, :notice => "Signed in successfully." else redirect_to new_user_registration_url end end end } end end |
Instance Method Details
#handle_unverified_request ⇒ Object
This is solution for existing accout want bind Google login but current_user is always nil github.com/intridea/omniauth/issues/185
31 32 33 |
# File 'app/controllers/users/omniauth_callbacks_controller.rb', line 31 def handle_unverified_request true end |