Sha256: 990d28eea52d8aaa9d25713b5d719b1250975145c07207a68483e4e05cfb37f6
Contents?: true
Size: 702 Bytes
Versions: 10
Compression:
Stored size: 702 Bytes
Contents
# frozen_string_literal: true module Shipit 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 = User.find_or_create_from_github(auth.extra.raw_info) user.update(github_access_token: auth.credentials.token) user.id end end end
Version data entries
10 entries across 10 versions & 1 rubygems