Sha256: bd612ab16a399bb299ab033573163e993863c71fe7ec671c6cee2cc8994244a9

Contents?: true

Size: 434 Bytes

Versions: 4

Compression:

Stored size: 434 Bytes

Contents

module ShopifyApp::LoginProtection
  def shopify_session
    if session[:shopify]
      begin
        # session[:shopify] set in LoginController#finalize
        ShopifyAPI::Base.site = session[:shopify].site
        yield
      ensure 
        ShopifyAPI::Base.site = nil
      end
    else
      session[:return_to] = request.fullpath
      redirect_to login_path
    end
  end
  
  def current_shop
    session[:shopify]
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
shopify_app-2.1.2 lib/shopify_app/login_protection.rb
shopify_app-2.1.1 lib/shopify_app/login_protection.rb
shopify_app-2.1.0 lib/shopify_app/login_protection.rb
shopify_app-2.0.0 lib/shopify_app/login_protection.rb