Sha256: 8140a49ffeefe742be92bc493f80f0c7aa71c4bf1e6fd8c6a74930452579ae07

Contents?: true

Size: 878 Bytes

Versions: 4

Compression:

Stored size: 878 Bytes

Contents

module Ixtlan
  module Controllers
    module AuthenticationsController

      def self.included(base)
        base.skip_before_filter :guard
        base.skip_before_filter :authenticate, :only => :destroy

        # do not want to expose permissions settings on filesystem cache
        base.cache_headers :private
      end

      private

      USER = Object.full_const_get(::Ixtlan::Models::USER)

      protected
      def login_from_params
        auth = params[:authentication]
        USER.authenticate(auth[:login], auth[:password]) if auth
      end

      public
      def show
        render_successful_login
      end

      def create
        render_successful_login
      end

      def destroy
        authentication_logger.log_user(current_user.nil? ? nil : current_user.login, "logged out")
        session.clear
        head :ok
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ixtlan-0.4.3 lib/ixtlan/controllers/authentications_controller.rb
ixtlan-0.4.2 lib/ixtlan/controllers/authentications_controller.rb
ixtlan-0.4.1 lib/ixtlan/controllers/authentications_controller.rb
ixtlan-0.4.0 lib/ixtlan/controllers/authentications_controller.rb