Class: SessionsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
lib/generators/templates/sessions_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

Callback Route for OAuth flow



6
7
8
9
10
# File 'lib/generators/templates/sessions_controller.rb', line 6

def create
  @user = User.find_or_create_with_omniauth auth_hash
  session[:user_id] = @user.id
  redirect_to auth_path
end

#destroyObject

GET /logout



13
14
15
16
# File 'lib/generators/templates/sessions_controller.rb', line 13

def destroy
  session[:user_id] = nil
  redirect_to auth_path
end

#failureObject



18
19
20
# File 'lib/generators/templates/sessions_controller.rb', line 18

def failure
  redirect_to auth_path, notice: params[:message]
end

#infoObject



22
23
# File 'lib/generators/templates/sessions_controller.rb', line 22

def info
end