Class: BlogBasic::SessionsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- BlogBasic::SessionsController
- Defined in:
- app/controllers/blog_basic/sessions_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/controllers/blog_basic/sessions_controller.rb', line 8 def create auth = request.env["omniauth.auth"] logger.debug "Auth:" + auth.inspect user = User.where(:identifier_url => auth["uid"].to_s).first logger.debug "newlinedddd" logger.debug "Here, uid:" + auth["uid"].to_s + ", email:" + auth["info"].inspect user ||= User.create!(:identifier_url => auth["uid"].to_s) logger.debug "userid" + user.id.to_s #user ||= User.create!(:identifier_url => auth["uid"], # :email => auth["info"]["email"], # :first_name => auth["info"]["first_name"], # :last_name => auth["info"]["last_name"]) #user = User.create_with_omniauth(auth) session[:user_id] = user.id logger.debug "before" redirect_to '/', :notice => "Signed in!" logger.debug "after" end |
#destroy ⇒ Object
27 28 29 30 |
# File 'app/controllers/blog_basic/sessions_controller.rb', line 27 def destroy session[:user_id] = nil redirect_to main_app.root_url, :notice => "Signed out!" end |
#new ⇒ Object
5 6 |
# File 'app/controllers/blog_basic/sessions_controller.rb', line 5 def new end |