diff --git a/app/exceptions/handler.py b/app/exceptions/handler.py index 84fbbee4..3ef58ac0 100644 --- a/app/exceptions/handler.py +++ b/app/exceptions/handler.py @@ -434,14 +434,19 @@ def _redirect_to_login(request: Request) -> RedirectResponse: base_url = "/" if access_method == "path" and store: - full_prefix = ( - store_context.get("full_prefix", "/store/") - if store_context - else "/store/" - ) - base_url = f"{full_prefix}{store.subdomain}/" + platform = getattr(request.state, "platform", None) + platform_original_path = getattr(request.state, "platform_original_path", None) + if platform and platform_original_path and platform_original_path.startswith("/platforms/"): + base_url = f"/platforms/{platform.code}/storefront/{store.store_code}/" + else: + full_prefix = ( + store_context.get("full_prefix", "/storefront/") + if store_context + else "/storefront/" + ) + base_url = f"{full_prefix}{store.store_code}/" - login_url = f"{base_url}storefront/account/login" + login_url = f"{base_url}account/login" logger.debug(f"Redirecting to {login_url}") return RedirectResponse(url=login_url, status_code=302) # Fallback to root for unknown contexts (PLATFORM) diff --git a/app/modules/billing/templates/billing/admin/subscription-tiers.html b/app/modules/billing/templates/billing/admin/subscription-tiers.html index cf8f891d..8d87d375 100644 --- a/app/modules/billing/templates/billing/admin/subscription-tiers.html +++ b/app/modules/billing/templates/billing/admin/subscription-tiers.html @@ -352,7 +352,7 @@ x-transition:leave="transform transition ease-in-out duration-300" x-transition:leave-start="translate-x-0" x-transition:leave-end="translate-x-full" - class="w-screen max-w-lg" + class="w-screen max-w-lg h-full" >
Add some products to get started!
- + Browse Products@@ -301,7 +301,7 @@ document.addEventListener('alpine:init', () => { this.showToast('Failed to load product', 'error'); // Redirect back to products after error setTimeout(() => { - window.location.href = '{{ base_url }}storefront/products'; + window.location.href = '{{ base_url }}products'; }, 2000); } finally { this.loading = false; diff --git a/app/modules/catalog/templates/catalog/storefront/products.html b/app/modules/catalog/templates/catalog/storefront/products.html index ec531922..dec12551 100644 --- a/app/modules/catalog/templates/catalog/storefront/products.html +++ b/app/modules/catalog/templates/catalog/storefront/products.html @@ -73,14 +73,14 @@
Log in to your account to view and manage your wishlist.
- + Log InSave items you like by clicking the heart icon on product pages.
- + Browse ProductsJoin thousands of satisfied customers today
- View All Products diff --git a/app/modules/cms/templates/cms/storefront/landing-minimal.html b/app/modules/cms/templates/cms/storefront/landing-minimal.html index c77070a4..86a4949c 100644 --- a/app/modules/cms/templates/cms/storefront/landing-minimal.html +++ b/app/modules/cms/templates/cms/storefront/landing-minimal.html @@ -37,7 +37,7 @@ {# Single CTA #}Explore our collection and find what you're looking for
- Browse Products diff --git a/app/modules/customers/routes/api/storefront.py b/app/modules/customers/routes/api/storefront.py index 53e9beae..e9b08396 100644 --- a/app/modules/customers/routes/api/storefront.py +++ b/app/modules/customers/routes/api/storefront.py @@ -178,23 +178,8 @@ def customer_login( }, ) - # Calculate cookie path based on store access method - store_context = getattr(request.state, "store_context", None) - access_method = ( - store_context.get("detection_method", "unknown") - if store_context - else "unknown" - ) - - cookie_path = "/storefront" - if access_method == "path": - full_prefix = ( - store_context.get("full_prefix", "/store/") - if store_context - else "/store/" - ) - cookie_path = f"{full_prefix}{store.subdomain}/storefront" - + # Set cookie with path=/ so it's sent with all requests + # (platform prefix varies between dev and prod, broad path avoids mismatch) response.set_cookie( key="customer_token", value=login_result["token_data"]["access_token"], @@ -202,12 +187,12 @@ def customer_login( secure=should_use_secure_cookies(), samesite="lax", max_age=login_result["token_data"]["expires_in"], - path=cookie_path, + path="/", ) logger.debug( f"Set customer_token cookie with {login_result['token_data']['expires_in']}s expiry " - f"(path={cookie_path}, httponly=True, secure={should_use_secure_cookies()})", + f"(path=/, httponly=True, secure={should_use_secure_cookies()})", ) return CustomerLoginResponse( @@ -237,25 +222,9 @@ def customer_logout(request: Request, response: Response): }, ) - store_context = getattr(request.state, "store_context", None) - access_method = ( - store_context.get("detection_method", "unknown") - if store_context - else "unknown" - ) + response.delete_cookie(key="customer_token", path="/") - cookie_path = "/storefront" - if access_method == "path" and store: - full_prefix = ( - store_context.get("full_prefix", "/store/") - if store_context - else "/store/" - ) - cookie_path = f"{full_prefix}{store.subdomain}/storefront" - - response.delete_cookie(key="customer_token", path=cookie_path) - - logger.debug(f"Deleted customer_token cookie (path={cookie_path})") + logger.debug("Deleted customer_token cookie (path=/)") return LogoutResponse(message="Logged out successfully") diff --git a/app/modules/customers/routes/pages/storefront.py b/app/modules/customers/routes/pages/storefront.py index 60a87d3c..9a2bf34e 100644 --- a/app/modules/customers/routes/pages/storefront.py +++ b/app/modules/customers/routes/pages/storefront.py @@ -153,14 +153,19 @@ async def shop_account_root(request: Request): base_url = "/" if access_method == "path" and store: - full_prefix = ( - store_context.get("full_prefix", "/store/") - if store_context - else "/store/" - ) - base_url = f"{full_prefix}{store.subdomain}/" + platform = getattr(request.state, "platform", None) + platform_original_path = getattr(request.state, "platform_original_path", None) + if platform and platform_original_path and platform_original_path.startswith("/platforms/"): + base_url = f"/platforms/{platform.code}/storefront/{store.store_code}/" + else: + full_prefix = ( + store_context.get("full_prefix", "/storefront/") + if store_context + else "/storefront/" + ) + base_url = f"{full_prefix}{store.store_code}/" - return RedirectResponse(url=f"{base_url}storefront/account/dashboard", status_code=302) + return RedirectResponse(url=f"{base_url}account/dashboard", status_code=302) # ============================================================================ diff --git a/app/modules/customers/templates/customers/storefront/addresses.html b/app/modules/customers/templates/customers/storefront/addresses.html index 952942df..56fa6072 100644 --- a/app/modules/customers/templates/customers/storefront/addresses.html +++ b/app/modules/customers/templates/customers/storefront/addresses.html @@ -400,7 +400,7 @@ function addressesPage() { if (!response.ok) { if (response.status === 401) { - window.location.href = '{{ base_url }}storefront/account/login'; + window.location.href = '{{ base_url }}account/login'; return; } throw new Error('Failed to load addresses'); diff --git a/app/modules/customers/templates/customers/storefront/dashboard.html b/app/modules/customers/templates/customers/storefront/dashboard.html index 01e321c8..f096e3c6 100644 --- a/app/modules/customers/templates/customers/storefront/dashboard.html +++ b/app/modules/customers/templates/customers/storefront/dashboard.html @@ -18,7 +18,7 @@+ href="{{ base_url }}"> â Continue shopping
diff --git a/app/modules/customers/templates/customers/storefront/login.html b/app/modules/customers/templates/customers/storefront/login.html index 64955081..a78b295a 100644 --- a/app/modules/customers/templates/customers/storefront/login.html +++ b/app/modules/customers/templates/customers/storefront/login.html @@ -127,7 +127,7 @@ style="color: var(--color-primary);"> Remember me - Forgot password? @@ -150,13 +150,13 @@ Don't have an account? + href="{{ base_url }}account/register"> Create an account @@ -263,7 +263,7 @@ // Redirect to account page or return URL setTimeout(() => { - const returnUrl = new URLSearchParams(window.location.search).get('return') || '{{ base_url }}storefront/account'; + const returnUrl = new URLSearchParams(window.location.search).get('return') || '{{ base_url }}account'; window.location.href = returnUrl; }, 1000); diff --git a/app/modules/customers/templates/customers/storefront/profile.html b/app/modules/customers/templates/customers/storefront/profile.html index 36b33ef3..9cea94c0 100644 --- a/app/modules/customers/templates/customers/storefront/profile.html +++ b/app/modules/customers/templates/customers/storefront/profile.html @@ -11,7 +11,7 @@