jetpack icon indicating copy to clipboard operation
jetpack copied to clipboard

SSO: Show wp-admin login form if site has local users

Open mmtr opened this issue 1 year ago • 1 comments

Fixes https://github.com/Automattic/jetpack/issues/39037

Proposed changes:

Stops enforcing the WP.com login for Atomic sites with local users.

Before After
Screenshot 2024-08-29 at 16 15 27 Screenshot 2024-08-29 at 16 16 32

Previously, we were disabling the enforced WP.com login on sites with the classic interface (except for users coming from Calypso), and kept it on sites with the default interface.

However, sites with the default interface can have local users as well (users not connected to WP.com) who are unable to use their wp-admin credentials to log in into wp-admin.

This PR fixes that by changing who is enforced to log in with a WP.com account:

  • Sites without local users:
    • WP.com login, always.
  • Sites with local users:
    • If user comes from Calypso: WP.com login
    • Otherwise: Jetpack SSO login, so they can decide whether to use a WP.com account or a local account.

Other information:

  • [ ] Have you written new tests for your changes, if applicable?
  • [ ] Have you checked the E2E test CI results, and verified that your changes do not break them?
  • [ ] Have you tested your changes on WordPress.com, if applicable (if so, you'll see a generated comment below with a script to run)?

Jetpack product discussion

pc4f5j-4Ky-p2

Does this pull request change what data or activity we track or use?

No

Testing instructions:

  • Install Jetpack Beta on a WoA dev site
  • Open Jetpack Beta and activate the branch of this PR in the WordPress.com Site Helper plugin (wpcomsh).
  • Go to https://wordpress.com/settings/general and select your WoA dev site
  • Activate the default admin interface
  • Go to /wp-admin/users.php
  • Create a new local user (do not invite the user to WP.com)
  • Open an incognito/private window
  • Go to /wp-admin
  • Make sure the Jetpack SSO login form shows up which allows you to use either a WP.com account or a local account
  • Go to wordpress.com
  • Log in
  • While in Calypso, switch to your WoA dev site
  • Click on any menu that links to wp-admin (e.g. Settings > Media)
  • Make sure you're automatically logged in
  • Close the incognito/private window
  • Remove all the local users from your site
  • Open an incognito/private window
  • Go to /wp-admin
  • Make sure you're redirected to the WP.com login
  • Close the incognito/private window
  • Activate the classic admin interface now
  • Repeat the steps above and confirm that you get the same results

mmtr avatar Aug 29 '24 14:08 mmtr

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • :white_check_mark: Include a description of your PR changes.
  • :white_check_mark: Add a "[Status]" label (In Progress, Needs Team Review, ...).
  • :white_check_mark: Add testing instructions.
  • :white_check_mark: Specify whether this PR includes any changes to data or privacy.
  • :white_check_mark: Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation :robot:


The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available.


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Choose a review path based on your changes:
    • A. Team Review: add the "[Status] Needs Team Review" label
      • For most changes, including minor cross-team impacts.
      • Example: Updating a team-specific component or a small change to a shared library.
    • B. Crew Review: add the "[Status] Needs Review" label
      • For significant changes to core functionality.
      • Example: Major updates to a shared library or complex features.
    • C. Both: Start with Team, then request Crew
      • For complex changes or when you need extra confidence.
      • Example: Refactor affecting multiple systems.
  3. Get at least one approval before merging.

Still unsure? Reach out in #jetpack-developers for guidance!


Wpcomsh plugin:

  • Next scheduled release: on demand (usually Mondays if not sooner).

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

github-actions[bot] avatar Aug 29 '24 14:08 github-actions[bot]