Class: Shipit::GithubAuthenticationController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
app/controllers/shipit/github_authentication_controller.rb

Instance Method Summary collapse

Instance Method Details

#callbackObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/controllers/shipit/github_authentication_controller.rb', line 7

def callback
  return_url = request.env['omniauth.origin'] || root_path
  auth = request.env['omniauth.auth']

  return render('failed', layout: false) if auth.blank?

  session[:user_id] = (auth)

  # We need to set this so that the /events and /sidekiq endpoint
  # which leverage `UserRequiredMiddleware` will recognize the user
  # is authenticated.
  session[:authenticated] = true

  redirect_to(return_url)
end

#logoutObject



23
24
25
26
# File 'app/controllers/shipit/github_authentication_controller.rb', line 23

def logout
  reset_session
  redirect_to(root_path)
end