Sha256: a1689e550d23bf0a54a6c497e99f444c6c6452c2fa68605d18a295f35922bee7

Contents?: true

Size: 834 Bytes

Versions: 5

Compression:

Stored size: 834 Bytes

Contents

class SessionsController < ApplicationController

  respond_to :html, :js

  before_filter :authenticate!, :only => [:destroy]
  before_filter :deauthenticate!, :only => [:new, :create]

  # GET /session/new
  def new
    @session = Session.new

    respond_with(@session)
  end

  # POST /session
  def create
    @session = Session.new(params[:session])

    flash[:notice] = 'Session create successful.' if @session.valid?
    flash[:error] = 'Session create failed.' if @session.invalid?

    authenticate(@session.user) if @session.valid?
    respond_with(@session, :location => restore(:default => root_path))
  end

  # DELETE /session
  def destroy
    flash[:notice] = 'Session destroyed.'

    deauthenticate()

    respond_to do |format|
      format.html { redirect_to(restore(:default => root_path)) }
    end
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
formula-1.0.0 test/dummy/app/controllers/sessions_controller.rb
formula-0.3.9 test/dummy/app/controllers/sessions_controller.rb
formula-0.3.8 test/dummy/app/controllers/sessions_controller.rb
formula-0.3.7 test/dummy/app/controllers/sessions_controller.rb
formula-0.3.6 test/dummy/app/controllers/sessions_controller.rb