Sha256: d723116dcce5d54e44f540e69f48289909b1c55f126043d23c1148dc17abd992

Contents?: true

Size: 816 Bytes

Versions: 1

Compression:

Stored size: 816 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

1 entries across 1 versions & 1 rubygems

Version Path
insales_api-0.2.0 lib/insales/controller/session_actions.rb