Sha256: c525c7abd66346c8466f83229064dc21fdc7401708b00c25ecb81f61ad8dce0a

Contents?: true

Size: 572 Bytes

Versions: 1

Compression:

Stored size: 572 Bytes

Contents

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

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

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

  def failure
    redirect_to_unauth notice: params[:message]
  end

  def info
  end

  private

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dailycred-0.2.0 app/controllers/sessions_controller.rb