Class: Dailycred::SessionsController

Inherits:
ApplicationController
  • Object
show all
Includes:
Helpers
Defined in:
app/controllers/dailycred/sessions_controller.rb

Instance Method Summary collapse

Methods included from Helpers

#authenticate, #connect_path, #connect_user, #dailycred, #login_path, #redirect_to_auth, #redirect_to_unauth, #set_state

Instance Method Details

#createObject

Callback Route for OAuth flow



8
9
10
11
12
# File 'app/controllers/dailycred/sessions_controller.rb', line 8

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

#destroyObject

GET /logout



15
16
17
18
# File 'app/controllers/dailycred/sessions_controller.rb', line 15

def destroy
  session[:user_id] = nil
  redirect_to_unauth
end

#failureObject



20
21
22
# File 'app/controllers/dailycred/sessions_controller.rb', line 20

def failure
  redirect_to_unauth notice: params[:message]
end

#infoObject



24
25
# File 'app/controllers/dailycred/sessions_controller.rb', line 24

def info
end