Sha256: 7422f5627b772ca1a63f4fea5ba56f7a6fa6839d0e4a355a8c5d474a71ad2319

Contents?: true

Size: 567 Bytes

Versions: 2

Compression:

Stored size: 567 Bytes

Contents

class SessionsController < ApplicationController
  before_filter :authenticate, :only => [:destroy]
  before_filter :current_user

  # Callback Route for OAuth flow
  def create
    @user = User.find_or_create_with_omniauth auth_hash
    session[:user_id] = @user.id
    redirect_to auth_info_path
  end

  #GET /logout
  def destroy
    session[:user_id] = nil
    redirect_to auth_info_path
  end

  def failure
    redirect_to auth_info_path, notice: params[:message]
  end

  def info
  end

  private

  def auth_hash
    request.env['omniauth.auth']
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dailycred-0.1.29 lib/generators/templates/sessions_controller.rb
dailycred-0.1.28 lib/generators/templates/sessions_controller.rb