Sha256: 5b729c91e21196484678a865d9e51bc2a4338fcbdd392740cca46d07c7a615bc

Contents?: true

Size: 540 Bytes

Versions: 1

Compression:

Stored size: 540 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
  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
    request.env['omniauth.auth']
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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