forked from External/greenlight
18 lines
380 B
Ruby
18 lines
380 B
Ruby
class SessionsController < ApplicationController
|
|
def create
|
|
@user = User.from_omniauth(request.env['omniauth.auth'])
|
|
session[:user_id] = @user.id
|
|
rescue => e
|
|
logger.error "Error authenticating via omniauth: #{e}"
|
|
ensure
|
|
redirect_to root_path
|
|
end
|
|
|
|
def destroy
|
|
if current_user
|
|
session.delete(:user_id)
|
|
end
|
|
redirect_to root_path
|
|
end
|
|
end
|