OSDN Git Service

fix: omniauth twitter
[pettanr/pettanr.git] / app / controllers / omniauth_callbacks_controller.rb
1 class OmniauthCallbacksController < ApplicationController
2   
3   def all
4     user = User.from_omniauth(request.env["omniauth.auth"])
5     if user.persisted?
6       flash.notice = "login successful!!"
7       sign_in_and_redirect user
8     else
9       session["devise.user_attributes"] = user.attributes
10       redirect_to new_user_registration_url
11     end
12   end
13   
14   def twitter
15     self.all
16   end
17   
18   def failure
19     return render :json => {:success => false, :errors => ["Login failed."]}
20   end
21   
22 end