Module: ShopifyApp::LoginProtection

Extended by:
ActiveSupport::Concern
Includes:
Itp
Included in:
CallbackController, SessionsController
Defined in:
lib/shopify_app/controller_concerns/login_protection.rb

Defined Under Namespace

Classes: ShopifyDomainNotFound

Instance Method Summary collapse

Instance Method Details

#login_again_if_different_shopObject



34
35
36
37
38
39
# File 'lib/shopify_app/controller_concerns/login_protection.rb', line 34

def 
  if shop_session && params[:shop] && params[:shop].is_a?(String) && (shop_session.url != params[:shop])
    clear_shop_session
    
  end
end

#shop_sessionObject



29
30
31
32
# File 'lib/shopify_app/controller_concerns/login_protection.rb', line 29

def shop_session
  return unless session[:shopify]
  @shop_session ||= ShopifyApp::SessionRepository.retrieve(session[:shopify])
end

#shopify_sessionObject



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/shopify_app/controller_concerns/login_protection.rb', line 17

def shopify_session
  return  unless shop_session
  clear_top_level_oauth_cookie

  begin
    ShopifyAPI::Base.activate_session(shop_session)
    yield
  ensure
    ShopifyAPI::Base.clear_session
  end
end