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