readd sessions_controller

This commit is contained in:
Joerg Reichert 2016-04-10 15:24:58 +02:00
parent 652f3516ae
commit 16d6b7c389
2 changed files with 21 additions and 0 deletions

View file

@ -0,0 +1,19 @@
class SessionsController < ApplicationController
def create
if user = User.find_or_create_from_auth_hash(auth_hash)
session[:user_id] = user.id
end
redirect_to root_path
end
def destroy
reset_session
redirect_to root_path
end
protected
def auth_hash
request.env['omniauth.auth']
end
end