Class: LocalDevise::OmniauthCallbacksController

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

Instance Method Summary collapse

Instance Method Details

#allObject Also known as: twitter


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

def all
  auth = request.env["omniauth.auth"]
  if auth.valid? 
    user = User.from_omniauth(auth)
    if user.persisted? && user.confirmed? && user.unconfirmed_email.blank?
      user.role = 'user' if user.role?('guest')
      flash.notice = t(:signed_in, :scope => 'devise.sessions')
       user
      (user)
      redirect_to(request.env['omniauth.origin'] || root_path)
    else
      redirect_after_auth_failure(user)
    end
  else
     redirect_after_auth_failure
  end
end