Skip to content

Commit

Permalink
Use expired? from shopify_api 13.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
gbzodek committed Jan 23, 2024
1 parent c653b19 commit f69d52d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
3 changes: 1 addition & 2 deletions lib/shopify_app/controller_concerns/login_protection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ def activate_shopify_session
return redirect_to_login
end

if ShopifyApp.configuration.check_session_expiry_date && current_shopify_session.expires &&
current_shopify_session.expires < Time.now
if ShopifyApp.configuration.check_session_expiry_date && current_shopify_session.expired?
ShopifyApp::Logger.debug("Session expired, redirecting to login")
clear_shopify_session
return redirect_to_login
Expand Down
1 change: 1 addition & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def mock_session(shop: "my-shop.myshopify.com", scope: ShopifyApp.configuration.
mock_session.stubs(:scope).returns(ShopifyAPI::Auth::AuthScopes.new(scope))
mock_session.stubs(:shopify_session_id).returns(1)
mock_session.stubs(:expires).returns(nil)
mock_session.stubs(:expired?).returns(false)

mock_session
end
Expand Down

0 comments on commit f69d52d

Please sign in to comment.