Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Themes] - Improve storefront password detection for password-protected shops with redirects #4936

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jamesmengo
Copy link
Contributor

@jamesmengo jamesmengo commented Nov 28, 2024

WHY are these changes introduced?

Closes https://github.com/Shopify/develop-advanced-edits/issues/444

Fixes an issue with password protection detection in storefronts by improving the URL validation approach.

If you shop has a redirect, the path is as follows:

  • test.myshopify.com -> test.redirected.com -> test.redirect.com/password

Also, some domains return a 301 rather than a 302.

In the long run, this should be moved to an API call to make this more robust - that's not currently possible.

WHAT is this pull request doing?

Updates the storefront password protection check to use the final URL from the response instead of checking redirect headers.

This simplifies the logic and handles both direct and redirect cases uniformly.

How to test your changes?

  1. Set up a password-protected development store with a redirected URL
  2. Run theme dev on that store
  3. Verify that you are getting prompted to enter your password - opening the localhost should render your home-page, not the password page
  4. Inputting your password correctly should allow you to skip the password page when you open the local-host preview.
🎥 Video uploaded on Graphite:

Measuring impact

  • n/a - this doesn't need measurement, e.g. a linting rule or a bug-fix

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes

Copy link
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copy link
Contributor

github-actions bot commented Nov 28, 2024

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements
75.24% (-0.1% 🔻)
8651/11498
🟡 Branches
70.6% (-0.08% 🔻)
4222/5980
🟡 Functions
74.83% (-0.14% 🔻)
2268/3031
🟡 Lines
75.81% (-0.1% 🔻)
8183/10794
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🟢
... / app.test-data.ts
92.51%
93.4% (-0.24% 🔻)
83.75% 92%
🟢
... / specification.ts
88.89% (-0.66% 🔻)
86.36% (-0.59% 🔻)
88% (-0.46% 🔻)
87.27% (-0.66% 🔻)
🟢
... / ui_extension.ts
97.5% (-0.58% 🔻)
83.33% (-3.33% 🔻)
100%
97.44% (-0.64% 🔻)
🟢
... / app-event-watcher.ts
93.42% (-1.52% 🔻)
87.88% (-0.69% 🔻)
90.48%
98.53% (-0.06% 🔻)
🟢
... / app-watcher-esbuild.ts
88.89% (-4.44% 🔻)
87.5% (-2.5% 🔻)
86.67% (-3.33% 🔻)
93.94% (-3.56% 🔻)
🟢
... / file-watcher.ts
80.22% (-4.47% 🔻)
69.77% (-0.69% 🔻)
79.17% (-8.83% 🔻)
85% (-4.53% 🔻)
🟡
... / common.ts
80%
62.5% (-7.5% 🔻)
71.43% 78.95%
🟢
... / ConcurrentOutput.tsx
98.36% (-1.64% 🔻)
88% (-4% 🔻)
100%
98.33% (-1.67% 🔻)

Test suite run success

1958 tests passing in 888 suites.

Report generated by 🧪jest coverage report action from 115718c

@jamesmengo jamesmengo changed the title fix - Fix storefront password detection for password-protected shops with redirects fix - Improve storefront password detection for password-protected shops with redirects Nov 28, 2024
@jamesmengo jamesmengo marked this pull request as ready for review November 28, 2024 00:24
@jamesmengo jamesmengo requested review from a team as code owners November 28, 2024 00:24
@jamesmengo jamesmengo changed the title fix - Improve storefront password detection for password-protected shops with redirects [Themes] - Improve storefront password detection for password-protected shops with redirects Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants