Sha256: 1718c4de16c9e5e1b8d31ad201276c4ea293cf90a10d026800d2d138c32c6e1b

Contents?: true

Size: 787 Bytes

Versions: 11

Compression:

Stored size: 787 Bytes

Contents

module Locomotive
  module Api
    class TokensController < Locomotive::Api::BaseController

      skip_before_filter :require_account

      def create
        begin
          token = Account.create_api_token(current_site, params[:email], params[:password])
          respond_with({ :token => token }, :location => root_url)
        rescue Exception => e
          respond_with({ :message => e.message }, :status => 401, :location => root_url)
        end
      end

      def destroy
        begin
          token = Account.invalidate_api_token(params[:id])
          respond_with({ :token => token }, :location => root_url)
        rescue Exception => e
          respond_with({ :message => e.message }, :status => 404, :location => root_url)
        end
      end

    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
locomotive_cms-2.0.0.rc12 app/controllers/locomotive/api/tokens_controller.rb
locomotive_cms-2.0.0.rc11 app/controllers/locomotive/api/tokens_controller.rb
locomotive_cms-2.0.0.rc10 app/controllers/locomotive/api/tokens_controller.rb
locomotive_cms-2.0.0.rc9 app/controllers/locomotive/api/tokens_controller.rb
locomotive_cms-2.0.0.rc8 app/controllers/locomotive/api/tokens_controller.rb
locomotive_cms-2.0.0.rc7 app/controllers/locomotive/api/tokens_controller.rb
locomotive_cms-2.0.0.rc6 app/controllers/locomotive/api/tokens_controller.rb
locomotive_cms-2.0.0.rc5 app/controllers/locomotive/api/tokens_controller.rb
locomotive_cms-2.0.0.rc4 app/controllers/locomotive/api/tokens_controller.rb
locomotive_cms-2.0.0.rc2 app/controllers/locomotive/api/tokens_controller.rb
locomotive_cms-2.0.0.rc1 app/controllers/locomotive/api/tokens_controller.rb