Skip to content
This repository has been archived by the owner on Nov 30, 2022. It is now read-only.

Commit

Permalink
Issue 18 investigation
Browse files Browse the repository at this point in the history
  • Loading branch information
gnikyt committed Mar 15, 2018
1 parent f6604c5 commit 37672d2
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/ShopifyApp/Middleware/AuthShop.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function handle(Request $request, Closure $next)
// Either no shop session or shops do not match
session()->forget('shopify_domain');

return redirect()->route('authenticate')->with('shop', $shopParam);
return redirect()->route('authenticate', ['shop' => $shopParam]);
}

// Shop is OK, move on...
Expand Down
3 changes: 1 addition & 2 deletions src/ShopifyApp/Traits/AuthControllerTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,14 @@ public function index()
public function authenticate()
{
// Grab the shop domain (uses session if redirected from middleware)
$shopDomain = request('shop') ?: session('shop');
$shopDomain = request('shop');
if (!$shopDomain) {
// Back to login, no shop
return redirect()->route('login');
}

// Save shop domain to session
session(['shopify_domain' => ShopifyApp::sanitizeShopDomain($shopDomain)]);
session()->forget('shop');

if (!request('code')) {
// Handle a request without a code
Expand Down
2 changes: 1 addition & 1 deletion tests/Middleware/AuthShopMiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function testShopsWhichDoNotMatchShouldKillSessionAndDirectToReAuthentica
});

$this->assertFalse($called);
$this->assertEquals('example-different-shop.myshopify.com', session('shop'));
$this->assertEquals('example-different-shop.myshopify.com', request('shop'));
}

public function testHeadersForEsdkShouldBeAdjusted()
Expand Down

0 comments on commit 37672d2

Please sign in to comment.