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

Checkout: redirect logged-out users to login page #24687

Merged
merged 1 commit into from
May 8, 2018

Conversation

taggon
Copy link
Contributor

@taggon taggon commented May 4, 2018

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.

Before After
screenshot screenshot

How to Test

  1. Visit a URL for subscription renewal like /checkout/$PLAN_SLUG/renew/$PURCHASE_ID/$SITE_DOMAIN while logged-out.
  2. You should be redirected to the login page.
  3. When you are successfully signed in, you should be redirected to the checkout page.

cc @dzver @mattwiebe

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.
@taggon taggon added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. [Feature] Checkout The checkout screen and process for purchases made on WordPress.com. [Status] Needs e2e Testing labels May 4, 2018
@taggon taggon self-assigned this May 4, 2018
@matticbot
Copy link
Contributor

Copy link
Contributor

@mattwiebe mattwiebe left a 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.

@taggon taggon merged commit c4ce061 into master May 8, 2018
@taggon taggon deleted the update/login-redirect-to-checkout branch May 8, 2018 10:16
@matticbot matticbot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label May 8, 2018
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 1, 2019
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.
jsnajdr added a commit that referenced this pull request Feb 6, 2019
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.
jsnajdr added a commit that referenced this pull request Feb 7, 2019
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.
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
Labels
[Feature] Checkout The checkout screen and process for purchases made on WordPress.com.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants