Sha256: bb361d0fba02b00a5b2e7bcbdfdeab6b442e9f5bea5760dd81c0f36c244bc2ad

Contents?: true

Size: 576 Bytes

Versions: 22

Compression:

Stored size: 576 Bytes

Contents

class GithubAuthenticationController < ActionController::Base
  include Shipit::Engine.routes.url_helpers

  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] = sign_in_github(auth)
    redirect_to return_url
  end

  def logout
    reset_session
    redirect_to root_path
  end

  private

  def sign_in_github(auth)
    user = Shipit.github_api.user(auth[:info][:nickname])
    User.find_or_create_from_github(user).id
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
shipit-engine-0.5.2 app/controllers/github_authentication_controller.rb
shipit-engine-0.5.1 app/controllers/github_authentication_controller.rb
shipit-engine-0.5.0 app/controllers/github_authentication_controller.rb
shipit-engine-0.4.10 app/controllers/github_authentication_controller.rb
shipit-engine-0.4.9 app/controllers/github_authentication_controller.rb
shipit-engine-0.4.8 app/controllers/github_authentication_controller.rb
shipit-engine-0.4.7 app/controllers/github_authentication_controller.rb
shipit-engine-0.4.6 app/controllers/github_authentication_controller.rb
shipit-engine-0.4.5 app/controllers/github_authentication_controller.rb
shipit-engine-0.4.4 app/controllers/github_authentication_controller.rb
shipit-engine-0.4.3 app/controllers/github_authentication_controller.rb
shipit-engine-0.4.2 app/controllers/github_authentication_controller.rb
shipit-engine-0.4.1 app/controllers/github_authentication_controller.rb
shipit-engine-0.4.0 app/controllers/github_authentication_controller.rb
shipit-engine-0.3.1 app/controllers/github_authentication_controller.rb
shipit-engine-0.3.0 app/controllers/github_authentication_controller.rb
shipit-engine-0.2.3 app/controllers/github_authentication_controller.rb
shipit-engine-0.2.2 app/controllers/github_authentication_controller.rb
shipit-engine-0.2.1 app/controllers/github_authentication_controller.rb
shipit-engine-0.2.0 app/controllers/github_authentication_controller.rb