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

Jetpack Connection: fix sign-up as a different user #78036

Merged
merged 5 commits into from
Jun 29, 2023

Conversation

sergeymitr
Copy link
Contributor

@sergeymitr sergeymitr commented Jun 12, 2023

Proposed Changes

During Jetpack connection flow, logged-in WPCOM users see the "Sign in as a different user" button, where users can enter a username or an email
If the entered email is not registered and you intend to register, you get redirected to the "My Home" page of your default site.

This happens because the form emails the user a "magic link" and redirects them to the "Magic link send" page. However, that page cannot be displayed as the user is still logged in under the old WPCOM account, so they get redirected to the homepage instead.

This PR will logout users as soon as they click "Sign in as a different user" button, so their other WPCOM account won't interfere.

1191179647901802-as-1203666065057524
p8oabR-11U-p2#comment-6947

Testing Instructions

Disable all cookie protection in browser settings, otherwise the flow will not work due to test/live domain discrepancies in API requests.

  1. Open the "Calypso Live" link below in a private window, login.
  2. Log into WP.com under the same user.
  3. Open a Jetpack site, Initiate WP connection flow.
  4. When you see the "Approve" page, replace wordpress.com with the *.calypso.live URL that got generated by "Calypso Live" link. The page should look the same.
  5. Click "Sign in as a different user". You should see the field to enter an email.
  6. Switch the domain back to https://wordpress.com/ because the "Calypso Live" doesn't seem to have magic link emails enabled. There are no changes on that page.
  7. Enter a registered (but different) email/username, confirm you got logged in and see the "Approve" page again.
  8. Repeat steps 1-5, and enter a non-registered email.
  9. You should see the "Magic link sent" page, and actually receive the email.
  10. Due to live/test domain name discrepancy, the magic link from email will not send you back to "Approve" page (that'll be tested after merging the PR), but it should create the WPCOM user account.

Don't forget to enable back the cookie protection settings!

Pre-merge Checklist

  • Has the general commit checklist been followed? (PCYsg-hS-p2)
  • Have you written new tests for your changes?
  • Have you tested the feature in Simple (P9HQHe-k8-p2), Atomic (P9HQHe-jW-p2), and self-hosted Jetpack sites (PCYsg-g6b-p2)?
  • Have you checked for TypeScript, React or other console errors?
  • Have you used memoizing on expensive computations? More info in Memoizing with create-selector and Using memoizing selectors and Our Approach to Data
  • Have we added the "[Status] String Freeze" label as soon as any new strings were ready for translation (p4TIVU-5Jq-p2)?
  • For changes affecting Jetpack: Have we added the "[Status] Needs Privacy Updates" label if this pull request changes what data or activity we track or use (p4TIVU-ajp-p2)?

@github-actions
Copy link

github-actions bot commented Jun 12, 2023

@matticbot
Copy link
Contributor

matticbot commented Jun 12, 2023

Here is how your PR affects size of JS and CSS bundles shipped to the user's browser:

App Entrypoints (~342 bytes added 📈 [gzipped])

name                   parsed_size           gzip_size
entry-stepper              +1520 B  (+0.1%)     +279 B  (+0.0%)
entry-main                 +1520 B  (+0.1%)     +264 B  (+0.1%)
entry-subscriptions         +864 B  (+0.1%)     +201 B  (+0.0%)
entry-login                 +864 B  (+0.1%)     +201 B  (+0.0%)
entry-domains-landing       +864 B  (+0.1%)     +201 B  (+0.1%)
entry-browsehappy           +864 B  (+0.7%)     +201 B  (+0.6%)

Common code that is always downloaded and parsed every time the app is loaded, no matter which route is used.

Sections (~21681 bytes added 📈 [gzipped])

name                          parsed_size           gzip_size
account                            +751 B  (+0.1%)     +222 B  (+0.1%)
notification-settings              +639 B  (+0.1%)      +87 B  (+0.0%)
help                               +587 B  (+0.1%)     +437 B  (+0.2%)
privacy                            +538 B  (+0.1%)     +356 B  (+0.2%)
me                                 +538 B  (+0.1%)     +345 B  (+0.2%)
account-close                      +538 B  (+0.1%)     +356 B  (+0.2%)
site-blocks                        +523 B  (+0.1%)      +63 B  (+0.0%)
accept-invite                      -491 B  (-0.1%)     -459 B  (-0.5%)
security                           +464 B  (+0.1%)     +116 B  (+0.0%)
purchases                          -427 B  (-0.0%)     -176 B  (-0.0%)
jetpack-connect                    +424 B  (+0.0%)     +210 B  (+0.1%)
write-flow                         -412 B  (-0.1%)       -6 B  (-0.0%)
videopress-flow                    -412 B  (-0.0%)       -6 B  (-0.0%)
update-design-flow                 -412 B  (-0.1%)       -6 B  (-0.0%)
signup                             -412 B  (-0.1%)       -6 B  (-0.0%)
link-in-bio-tld-flow               -412 B  (-0.0%)       -6 B  (-0.0%)
home                               -412 B  (-0.0%)       -6 B  (-0.0%)
free-flow                          -412 B  (-0.1%)       -6 B  (-0.0%)
build-flow                         -412 B  (-0.1%)       -6 B  (-0.0%)
comments                           -191 B  (-0.0%)     +475 B  (+0.2%)
devdocs                            +108 B  (+0.1%)      +24 B  (+0.0%)
reader                              +13 B  (+0.0%)      -19 B  (-0.0%)
pattern-assembler-step              -13 B  (-0.0%)       -5 B  (-0.0%)
newsletter-post-setup-flow          -13 B  (-0.0%)      -20 B  (-0.0%)
jetpack-cloud-partner-portal        -13 B  (-0.0%)      -31 B  (-0.0%)
jetpack-cloud-agency-signup         -13 B  (-0.0%)       -8 B  (-0.0%)
import-flow                         -13 B  (-0.0%)       -5 B  (-0.0%)

Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to.

Async-loaded Components (~830 bytes added 📈 [gzipped])

name                                                                         parsed_size           gzip_size
async-load-design-blocks                                                          +220 B  (+0.0%)    +1348 B  (+0.3%)
async-load-signup-steps-user                                                      -196 B  (-0.1%)     -513 B  (-1.2%)
async-load-automattic-global-styles-src-components-global-styles-variations        -13 B  (-0.0%)       -5 B  (-0.0%)
async-load-automattic-design-preview                                               -13 B  (-0.0%)       -5 B  (-0.0%)

React components that are loaded lazily, when a certain part of UI is displayed for the first time.

Legend

What is parsed and gzip size?

Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory.
Gzip Size: Compressed size of the JS and CSS files. This much data needs to be downloaded over network.

Generated by performance advisor bot at iscalypsofastyet.com.

@sergeymitr sergeymitr added [Type] Bug When a feature is broken and / or not performing as intended Jetpack [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. and removed [Status] In Progress labels Jun 13, 2023
Copy link

@bindlegirl bindlegirl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested everything as suggested and it works as expected.
I did notice a small difference between Calypso Green and WP.com form (Green has additional links for creating a new account, logging in via the app...), but that doesn't seem to make any difference for this scenario.

@bindlegirl bindlegirl added [Status] Ready to Merge and removed [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Jun 26, 2023
@sergeymitr sergeymitr merged commit 7f7643a into trunk Jun 29, 2023
@sergeymitr sergeymitr deleted the fix/jetpack-magic-link-signup branch June 29, 2023 19:14
escapemanuele pushed a commit that referenced this pull request Jul 3, 2023
Co-authored-by: Omar Alshaker <omar@omaralshaker.com>
Co-authored-by: Paulo Trentin <paulo@paulotrentin.com.br>
Co-authored-by: Gabriel Demichelis <gabrieldemichelis@gmail.com>
Co-authored-by: Philip Jackson <p-jackson@live.com>
Co-authored-by: Paulo Cruz <paulo.cruz@automattic.com>
Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com>
Co-authored-by: Luis Felipe Zaguini <26530524+zaguiini@users.noreply.github.com>
Co-authored-by: Payton Swick <payton@foolord.com>
Co-authored-by: Kosta <heavyweight@users.noreply.github.com>
Co-authored-by: Erick Danzer <edanzer@gmail.com>
Co-authored-by: Nicholas Sakaimbo <nsakaimbo@users.noreply.github.com>
Co-authored-by: Paulo Marcos Trentin <paulo@paulotrentin.com.br>
Co-authored-by: Sergey Mitroshin <sergeymitr@gmail.com>
Co-authored-by: Candy Tsai <candy02058912@gmail.com>
Co-authored-by: Daniel Bachhuber <daniel.bachhuber@automattic.com>
Co-authored-by: Wojtek Naruniec <wojtek@naruniec.me>
Co-authored-by: Aneesh Devasthale <aneeshd16@users.noreply.github.com>
Co-authored-by: Miguel San Segundo <1881481+miksansegundo@users.noreply.github.com>
Co-authored-by: Griffith Chen <griffith.chen@automattic.com>
Co-authored-by: Paul Bunkham <paul@dobit.co.uk>
Co-authored-by: Bogomil Stoynov <bogomil.stoynov@automattic.com>
Co-authored-by: Maciej Grabowski <mashikag@users.noreply.github.com>
Co-authored-by: Louis Laugesen <louis.laugesen@gmail.com>
Co-authored-by: timur987 <115007291+timur987@users.noreply.github.com>
Fix track events for buttons (#78759)
fix sign-up as a different user (#78036)
fixes (#78734)
escapemanuele added a commit that referenced this pull request Jul 3, 2023
* initial changes for bulk domain transfer redesign

* BulkDomainTransfer: conditionally show delete

* BulkDomainTransfer: display number of domains to be added

* BulkDomainTransfer: fix styles

* Progress bar is back (#78835)

* Bulk Domain Flow: Intro step (#78837)

* Unlock icon

* Learn more and some styling

* Font family

* Padding and button width

* Localize url

* Intentscreen without absolute positioning

* Padding mobile for intents

* Fix svg and accurate margin

* Fix select item width

* Padding in flow

* Overwrite css

* Missing cleanup

* Bulk Domain Flow: Improvements on styling and layout (#78847)

Co-authored-by: Omar Alshaker <omar@omaralshaker.com>
Co-authored-by: Paulo Trentin <paulo@paulotrentin.com.br>
Co-authored-by: Gabriel Demichelis <gabrieldemichelis@gmail.com>
Co-authored-by: Philip Jackson <p-jackson@live.com>
Co-authored-by: Paulo Cruz <paulo.cruz@automattic.com>
Co-authored-by: Chi-Hsuan Huang <chihsuan.tw@gmail.com>
Co-authored-by: Luis Felipe Zaguini <26530524+zaguiini@users.noreply.github.com>
Co-authored-by: Payton Swick <payton@foolord.com>
Co-authored-by: Kosta <heavyweight@users.noreply.github.com>
Co-authored-by: Erick Danzer <edanzer@gmail.com>
Co-authored-by: Nicholas Sakaimbo <nsakaimbo@users.noreply.github.com>
Co-authored-by: Paulo Marcos Trentin <paulo@paulotrentin.com.br>
Co-authored-by: Sergey Mitroshin <sergeymitr@gmail.com>
Co-authored-by: Candy Tsai <candy02058912@gmail.com>
Co-authored-by: Daniel Bachhuber <daniel.bachhuber@automattic.com>
Co-authored-by: Wojtek Naruniec <wojtek@naruniec.me>
Co-authored-by: Aneesh Devasthale <aneeshd16@users.noreply.github.com>
Co-authored-by: Miguel San Segundo <1881481+miksansegundo@users.noreply.github.com>
Co-authored-by: Griffith Chen <griffith.chen@automattic.com>
Co-authored-by: Paul Bunkham <paul@dobit.co.uk>
Co-authored-by: Bogomil Stoynov <bogomil.stoynov@automattic.com>
Co-authored-by: Maciej Grabowski <mashikag@users.noreply.github.com>
Co-authored-by: Louis Laugesen <louis.laugesen@gmail.com>
Co-authored-by: timur987 <115007291+timur987@users.noreply.github.com>
Fix track events for buttons (#78759)
fix sign-up as a different user (#78036)
fixes (#78734)

* Update back button location on domain input screen

* Adding styling changes

* Updating styling

* Deleting backup component and unused things

---------

Co-authored-by: heavyweight <kpapazov@gmail.com>
Co-authored-by: Emanuele Buccelli <escapemanuele@gmail.com>
Co-authored-by: Renan Carvalho <renan.carvalho@automattic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Jetpack [Type] Bug When a feature is broken and / or not performing as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants