Module: ShopifyApp::LoginProtection
Defined Under Namespace
Classes: ShopifyDomainNotFound
Instance Method Summary
collapse
Instance Method Details
#login_again_if_different_shop ⇒ Object
34
35
36
37
38
39
|
# File 'lib/shopify_app/controller_concerns/login_protection.rb', line 34
def login_again_if_different_shop
if shop_session && params[:shop] && params[:shop].is_a?(String) && (shop_session.url != params[:shop])
clear_shop_session
redirect_to_login
end
end
|
#shop_session ⇒ Object
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_session ⇒ Object
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 redirect_to_login unless shop_session
clear_top_level_oauth_cookie
begin
ShopifyAPI::Base.activate_session(shop_session)
yield
ensure
ShopifyAPI::Base.clear_session
end
end
|