Jetpack sign in - Step 1: Fetch Jetpack e-mail address for flowing through Magic Links#1483
Conversation
…essage when site is not found
…irect to magic link screen
Error TypeErrorDangerfileError TypeErrorDangerfileGenerated by 🚫 dangerJS |
|
You can test the changes on this Pull Request by downloading the APK here. |
There was a problem hiding this comment.
@anitaa1990 Just a few review notes from tonight that are not related to our conversation around the discovery process that will change a bunch of this PR:
- Keyboard stays visible when navigating to the “Magic Link” screen as well as the new
LoginNoJetpackFragment, but there are no text fields in these views.
- The new
LoginNoJetpackFragmentwas a bit confusing since we already have a screen almost identical to this one. Is this necessary because technically the user isn’t logged into WPcom when they view it? It would be helpful if the layout file was populated with values similar to what theLoginNoJetpackFragmentwould populate it with so it’s easier to visualize since it’s only used by this fragment. It would also be helpful to remove anything that isn’t used by this fragment like theuser_info_groupand renaming the root fromsite_picker_rootas it leads to a lot of confusion when trying to read the code. - Also regarding the
LoginNoJetpackFragment:
Where would I find this screen in the designs? The refresh the app to continue and Try again buttons do the same thing. The Log out in the username message looks like it should do something but it does not. I wonder if it would make more sense to have it follow the same layout as the current similar screen:
...except we change the primary button to LOGOUT (instead of having it at the top of the screen), and then set the secondary button to VIEW SETUP INSTRUCTIONS. Just some ideas if there is no official design yet. Looking forward to the next round!
…f the xmlrpc url is empty
…to LoginNoJetpackFragment
|
Thanks for the review @AmandaRiu! As discussed, I've reverted to logic to validate the site using the discovery API in e601f9b. The discovery process will now be initiated only when the user clicks on the
I was not able to replicate this but I added code to close the keypad before redirecting to the "Magic link" or
We need Jetpack to be installed/active/connected in order to support signing in with their site credentials. Only when Jetpack is connected, would we be able to get the
Done in 40b0360
Agreed! I removed the
I forgot to add the logout click functionality before. I added it in 40b0360. The design specs have two separate messages for when Jetpack is NOT installed and when Jetpack is installed but not connected. But since there is no way to know from the wp.getOptions API if jetpack is installed or installed but not connected, we're currently using only the LEFT side message in the app: The entire design flow can be found in #1482 . PR ready for another round 👍 |
AmandaRiu
left a comment
There was a problem hiding this comment.
@anitaa1990 I've finished another round and really excited about the progress so far!
Testing
I ran the following tests (all passed):
Test Current Functionality
- Basic login - with Jetpack and Woo
- Basic login - without Jetpack
- Basic login - without Woo
- Basic login - site does not belong to WPcom account
Test New Functionality
- Site creds login - with Jetpack and Woo
- Site creds login - without Jetpack
- Enable jetpack from last step and refresh - should get redirected to the site creds screen.
- Site creds login - without Woo
- Site creds login - site with multiple jetpacked accounts
Other Testing
- Log in to a non-existent site
- Log in with a non-WP site
- Enter a jetpack site and verify directed to the magic link screen
- Enter a bad password for site creds
- Enter an invalid username for site creds
NoJetpackFragment Testing
- Logout functionality
- Try again functionality
- View instructions
Code Review
I also left a bunch of code comments in addition to the following:
This only applies to Woo at the moment. I have not modified the existing implementation used by wp-android in LoginSiteAddressFragment.
We should definitely port that change to the LoginSiteAddressFragment to avoid issues in the future. Since you’re adding this base class in this PR I think it makes the most sense to port that over in this PR to keep it altogether.
I created a new fragment and xml file rather than reuse the existing one, because the existing one is in the SitePickerActivity which has a lot of logic in place to check if WooCommerce exists or if user is logged in etc. that is not relevant to this logic here.
Makes sense to me! 👍
WooCommerce/src/main/kotlin/com/woocommerce/android/ui/login/LoginJetpackRequiredFragment.kt
Outdated
Show resolved
Hide resolved
WooCommerce/src/main/kotlin/com/woocommerce/android/ui/login/LoginNoJetpackFragment.kt
Outdated
Show resolved
Hide resolved
...dPressLoginFlow/src/main/java/org/wordpress/android/login/LoginUsernamePasswordFragment.java
Outdated
Show resolved
Hide resolved
...WordPressLoginFlow/src/main/java/org/wordpress/android/login/LoginBaseDiscoveryFragment.java
Show resolved
Hide resolved
| private static final String ARG_INPUT_SITE_ADDRESS = "ARG_INPUT_SITE_ADDRESS"; | ||
| private static final String ARG_ENDPOINT_ADDRESS = "ARG_ENDPOINT_ADDRESS"; |
There was a problem hiding this comment.
A lot of these constants have duplicates declared in different classes. Every String constant in Java takes up memory and there is no check for duplicate strings unless we use the .intern() method so I wonder if we should move some of these out into a single location so they are accessible to the login library as a whole? Not something you have to do, just food for thought.
...dPressLoginFlow/src/main/java/org/wordpress/android/login/LoginUsernamePasswordFragment.java
Outdated
Show resolved
Hide resolved
...dPressLoginFlow/src/main/java/org/wordpress/android/login/LoginUsernamePasswordFragment.java
Outdated
Show resolved
Hide resolved
...dPressLoginFlow/src/main/java/org/wordpress/android/login/LoginUsernamePasswordFragment.java
Outdated
Show resolved
Hide resolved
|
Thanks for the thorough review @AmandaRiu! I've fixed all the code changes and PR ready for another round 👍
I agree that we should definitely port the And based on what we decide, we would be making changes to this class and it would make it easier to implement the changes first and then port things over from |






Partially fixes #1482. This PR completes the first step of the Jetpack sign in with self credentials as defined in the master thread.
Changes
Revert existing logic of validating site url fromSince using the discovery endpoint to validate the site would interfere with the existing logic of logging in using wp.com credentials, I've moved the discovery process to initiate only when the user enters their username + password in theFETCH_CONNECT_SITE_INFOendpoint and use theFETCH_WPCOM_SITE_BY_URLendpoint and initiate the discovery process.LoginUsernamePasswordFragment.LoginEmailFragment:Login via site credentials.LoginUsernamePasswordFragment.usernameinLoginUsernamePasswordFragment.wp.getOptionsendpoint to fetch thejetpack_user_emailand store inSiteModeland redirect to the request magic link screen.LoginNoJetpackFragment.Notes:
Since this PR removes the logic to validate site address using theFETCH_CONNECT_SITE_INFOendpoint, there are some events that will likely be invalidated once this feature is merged.LOGIN_CONNECTED_SITE_INFO_FAILEDLOGIN_CONNECTED_SITE_INFO_SUCCEEDEDDeviations from design:
LoginUsernamePasswordFragmentis set to justUsernamerather than justUsername or Emailbecause there is no option to pass email address via the API, just the username.Behaviour
(LEFT: Login with self hosted site with Jetpack . RIGHT: Login with self hosted site without Jetpack)
. 
Entering a non existent site:
Testing
Sign inat the bottom of the screen.Login with site credentials.Next.Refresh the applink. Notice that you are redirected to the Site credentials screen.Nextand verify that you are redirected to the Magic link sign in screen.Login with site credentials.Nextand verify that you are redirected to the Magic link sign in screen.Update release notes:
RELEASE-NOTES.txtif necessary.