Sha256: c5684387ab10d84201016b1999937c4a90020c1d1701f6c5366fa81f7a3168cb

Contents?: true

Size: 893 Bytes

Versions: 2

Compression:

Stored size: 893 Bytes

Contents

class SessionsController < ApplicationController

  skip_before_filter :authorization

  prepend_after_filter :reset_session, :only => :destroy

  public

  def create
    @session = Session.create(params[:authentication] || params)

    if @session
      current_user @session.user
      @session.permissions = guard.permissions(self)

      # TODO make html login
      respond_to do |format|
        format.html { render :text => "authorized - but nothing further is implemented" }
        format.xml  { render :xml => @session.to_xml }
        format.json  { render :json => @session.to_json }
      end
    else
      head :not_found
    end
  end

  def reset_password
    warn "not implemented"
    head :ok
  end

  def destroy
    # reset session happens in the after filter which allows for 
    # audit log with username which happens in another after filter
    head :ok
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
resty-generators-0.5.0 lib/generators/resty/setup/templates/sessions_controller.rb
resty-generators-0.4.0 lib/generators/resty/setup/templates/sessions_controller.rb