Sha256: 348104b06042c7aa86482f31b14fc64ae08a942e1bdec09e23997e099516e74c

Contents?: true

Size: 822 Bytes

Versions: 4

Compression:

Stored size: 822 Bytes

Contents

module Insales::Controller
  module SessionActions
    extend ActiveSupport::Concern

    included do
      skip_before_filter :insales_authenticate!, except: [:destroy]
    end

    def new
      # render
    end

    def create
      account = find_account_by_request
      return render_not_found unless account
      store_location(insales_success_login_path)
      insales_autologin_start(account)
    end

    def autologin
      if insales_autologin_finish
        redirect_to stored_location || insales_success_login_path
      else
        redirect_to action: :new
      end
    end

    def destroy
      insales_logout
      redirect_to action: :new
    end

    protected
      def render_not_found
        flash.now[:error] = t(:'.account_not_found').html_safe
        render action: :new
      end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
insales_api-0.1.3 lib/insales/controller/session_actions.rb
insales_api-0.1.2 lib/insales/controller/session_actions.rb
insales_api-0.1.1 lib/insales/controller/session_actions.rb
insales_api-0.1.0 lib/insales/controller/session_actions.rb