-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Checkout: redirect logged-out users to login page #24687
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When logged-out, a blank screen is displayed on the all checkout pages but `/checkout/:domain/:product?`. This trouble is caused by #22993 which fixed a bug filed in #22857 (see #23785 for the general problem). For example, renewal email was also affected by this bug (see p9jf6J-rI-p2). This PR fixes an empty page displayed to logged-out users when they try to access any `/checkout` pages.
mattwiebe
approved these changes
May 4, 2018
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works well in my testing and should be good to go. The full e2e tests had failed but seemed unrelated to this so I re-triggered them.
mattwiebe
added a commit
that referenced
this pull request
Jun 14, 2018
When you hit a valid route as a logged-out user, we should send you to the login page with a redirect back to the page you were trying to access. This is how all wp-admin links in core WP works. There have been fixes for individual pages (eg #24687 ) but this should be handled at the framework level. We have an email campaign using the Simple Payments Guided Tour #24627 and it freezes at a blank screen for a logged-out user. What this change does is to do a redirect for a valid section with the `enableLoggedOut` property set to true to the login screen with a redirect. A future PR could probably remove all bespoke uses of `import { redirectLoggedOut } from 'controller'` as well since this should supersede it.
jsnajdr
added a commit
that referenced
this pull request
Feb 7, 2019
…age (#30537) * Redirect sections that don't have the enableLoggedOut flag to login page Routes in sections that don't have the `enableLoggedOut` flag set to `true` should always redirect to login page when requested in a logged-out session. This patch removes the check-and-redirect code (which is broken anyway) from the `loggedOutMiddleware` function and moves it to the section loader handler. Which, until now, only loaded the section's webpack chunk. Now it also guards for unwanted (logged-out) visitors. * Remove per-route logged-out checks in /me/purchases Instead of per-route checks, remove the `enableLoggedOut` flag from the section and let the framework (section loader) do the login redirect. * Remove per-route logged-out checks in /me/security Instead of per-route checks, remove the `enableLoggedOut` flag from the section and let the framework (section loader) do the login redirect. Effectively reverts #27261 in favor of doing it The Right Way. * Remove per-route logged-out checks in /checkout Instead of per-route checks, remove the `enableLoggedOut` flag from the section and let the framework (section loader) do the login redirect. Effectively reverts #22993 and #24687 and replaces them with a better implementation. * Remove per-route logged-out checks in /domain-connect Instead of per-route checks, remove the `enableLoggedOut` flag from the section and let the framework (section loader) do the login redirect. Effectively reverts #25000 and replaces it with a better implementation. * Remove per-route logged-out checks in /google-my-business Instead of per-route checks, remove the `enableLoggedOut` flag from the section and let the framework (section loader) do the login redirect. * Remove per-route logged-out checks in Reader Instead of per-route checks, remove the `enableLoggedOut` flag from the section and let the framework (section loader) do the login redirect. Effectively reverts #25741 and replaces it with a better implementation. * Remove the enableLoggedOut flag from the Stats section Redirect to login page is handled in framework if the flag is false.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When logged-out, a blank screen is displayed on the all checkout pages but
/checkout/:domain/:product?
.This trouble is caused by #22993 which fixed a bug filed in #22857 (see #23785 for the general problem).
For example, a Jetpack renewal email was affected by this bug (see p9jf6J-rI-p2).
This PR fixes an empty page displayed to logged-out users when they try
to access any
/checkout
pages.How to Test
/checkout/$PLAN_SLUG/renew/$PURCHASE_ID/$SITE_DOMAIN
while logged-out.cc @dzver @mattwiebe