Class: OmniauthCallbacksController

Inherits:
Devise::OmniauthCallbacksController
  • Object
show all
Defined in:
app/controllers/omniauth_callbacks_controller.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.provides_callback_for(provider) ⇒ Object


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

def self.provides_callback_for(provider)
	class_eval %Q{
  def #{provider}
	@user = User.find_for_oauth(env["omniauth.auth"], current_user)

	if @user.persisted?
	  sign_in_and_redirect @user, event: :authentication
	  set_flash_message(:notice, :success, kind: "#{provider}".capitalize) if is_navigational_format?
	else
	  session["devise.#{provider}_data"] = env["omniauth.auth"]
	  redirect_to new_user_registration_url
	end
  end
  }
end

Instance Method Details

#after_sign_in_path_for(resource) ⇒ Object


22
23
24
25
26
27
28
# File 'app/controllers/omniauth_callbacks_controller.rb', line 22

def (resource)
	if resource.email_verified?
		super resource
	else
		(resource)
	end
end