Sha256: 5707dd1fc76b19fea4e5e0afe24ee2e3c0aafb7ad628bd3d286c65193abc88f4

Contents?: true

Size: 936 Bytes

Versions: 2

Compression:

Stored size: 936 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(@session.user.groups.collect {|g| g.name.to_s })

      # 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.3 lib/generators/resty/setup/templates/sessions_controller.rb
resty-generators-0.5.1 lib/generators/resty/setup/templates/sessions_controller.rb