Sha256: 55a6bfe5c1713d175afbab2e95c3ebc918f4c2922afc945b00f79a6711129a2e

Contents?: true

Size: 511 Bytes

Versions: 3

Compression:

Stored size: 511 Bytes

Contents

module Peoplefinder
  class SessionsController < ApplicationController
    skip_before_action :ensure_user

    def create
      person = Person.from_auth_hash(auth_hash)
      if person
        session['current_user_id'] = person.id
        redirect_to_desired_path
      else
        render :failed
      end
    end

    def new
    end

    def destroy
      session['current_user_id'] = nil
      redirect_to '/'
    end

  protected

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
peoplefinder-0.1.1 app/controllers/peoplefinder/sessions_controller.rb
peoplefinder-0.1.0 app/controllers/peoplefinder/sessions_controller.rb
peoplefinder-0.0.2 app/controllers/peoplefinder/sessions_controller.rb