Guest User

Untitled

a guest
Apr 26th, 2016
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. class SessionsController < ApplicationController
  2. def create
  3. auth = request.env["omniauth.auth"]
  4. session[:omniauth] = auth.except('extra')
  5. user = User.sign_in_from_omniauth(auth)
  6. session[:user_id] = user.id
  7. redirect_to root_url, notice: "SIGNED IN"
  8. end
  9.  
  10. def destroy
  11. session[:user_id] = nil
  12. session[:omniauth] = nil
  13. redirect_to root_path, notice: "SIGNED OUT"
  14. end
  15.  
  16. end
Advertisement
Add Comment
Please, Sign In to add comment