-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Duplicate the regular login flow to allow application password first iteration #21914
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
Duplicate the regular login flow to allow application password first iteration #21914
Conversation
…-flow-to-allow-Application-Password # Conflicts: # WordPress/src/main/java/org/wordpress/android/ui/mysite/cards/applicationpassword/ApplicationPasswordViewModelSlice.kt # WordPress/src/main/res/values/strings.xml
Generated by 🚫 Danger |
|
App Name | ![]() |
|
Flavor | Jalapeno | |
Build Type | Debug | |
Version | pr21914-e62e43d | |
Commit | e62e43d | |
Direct Download | wordpress-prototype-build-pr21914-e62e43d.apk |
|
App Name | ![]() |
|
Flavor | Jalapeno | |
Build Type | Debug | |
Version | pr21914-e62e43d | |
Commit | e62e43d | |
Direct Download | jetpack-prototype-build-pr21914-e62e43d.apk |
…-flow-to-allow-Application-Password
…ow-Application-Password' of https://github.com/wordpress-mobile/WordPress-Android into feature/CMM-398-duplicate-the-regular-login-flow-to-allow-Application-Password
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## trunk #21914 +/- ##
=======================================
Coverage 39.32% 39.32%
=======================================
Files 2138 2138
Lines 100404 100404
Branches 15415 15415
=======================================
Hits 39479 39479
Misses 57441 57441
Partials 3484 3484 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
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.
Pull Request Overview
This PR introduces the first iteration of the Application Password login option by duplicating the regular login flow and modifying the underlying networking and UI components. Key changes include:
- Adding a new error string for unsupported Application Password flows.
- Changing the visibility and API of the LoginSiteAddressValidator.
- Creating new fragments, view models, and tests for the Application Password login flow and updating the login activity and navigator to support it.
Reviewed Changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
libs/login/src/main/res/values/strings.xml | Added error string for unsupported Application Password authentication. |
libs/login/src/main/java/org/wordpress/android/login/LoginSiteAddressValidator.java | Made the validator public and updated method visibility. |
WordPress/src/test/java/org/wordpress/android/ui/mysite/cards/applicationpassword/ApplicationPasswordViewModelSliceTest.kt | Updated test cases to use the new helper method for authorization URL retrieval. |
WordPress/src/test/java/org/wordpress/android/ui/accounts/login/applicationpassword/LoginSiteApplicationPasswordViewModelTest.kt | Added new tests for the Application Password ViewModel. |
WordPress/src/test/java/org/wordpress/android/ui/accounts/login/ApplicationPasswordLoginHelperTest.kt | Updated tests to reflect changes in URL parameter appending logic. |
WordPress/src/main/java/org/wordpress/android/ui/mysite/cards/applicationpassword/ApplicationPasswordViewModelSlice.kt | Removed internal API discovery logic and integrated the helper’s method. |
WordPress/src/main/java/org/wordpress/android/ui/mysite/MySiteFragment.kt | Updated navigation to use the new Application Password login path via the activity navigator. |
WordPress/src/main/java/org/wordpress/android/ui/accounts/login/applicationpassword/LoginSiteApplicationPasswordViewModel.kt | Added new ViewModel for application password login. |
WordPress/src/main/java/org/wordpress/android/ui/accounts/login/applicationpassword/LoginSiteApplicationPasswordFragment.kt | Implemented the new fragment for Application Password login. |
WordPress/src/main/java/org/wordpress/android/ui/accounts/login/ApplicationPasswordLoginHelper.kt | Refactored error handling and consolidated Uri-building logic inside a wrapper. |
WordPress/src/main/java/org/wordpress/android/ui/accounts/LoginActivity.java | Updated logic to choose between the traditional and Application Password login flows based on feature flags. |
WordPress/src/main/java/org/wordpress/android/ui/ActivityNavigator.kt | Centralized custom tabs logic by adding a new method to launch Application Password logins. |
WordPress/src/main/java/org/wordpress/android/modules/ViewModelModule.java | Bound the new Application Password ViewModel for DI. |
WordPress/src/main/java/org/wordpress/android/modules/AppComponent.java | Injected the new Application Password Fragment. |
Comments suppressed due to low confidence (3)
libs/login/src/main/java/org/wordpress/android/login/LoginSiteAddressValidator.java:16
- Increasing the visibility from package-private to public may expose internal APIs; ensure this change aligns with the intended design and usage.
public class LoginSiteAddressValidator {
WordPress/src/main/java/org/wordpress/android/ui/mysite/cards/applicationpassword/ApplicationPasswordViewModelSlice.kt:79
- Confirm that the removal of internal error handling in favor of relying on the helper’s exception management covers all relevant edge cases in production.
val authorizationUrlComplete = applicationPasswordLoginHelper.getAuthorizationUrlComplete(site.url)
WordPress/src/main/java/org/wordpress/android/ui/ActivityNavigator.kt:217
- Consolidating the custom tabs launch logic here improves code reuse; ensure that all similar implementations elsewhere have been updated to leverage this method.
fun openApplicationPasswordLogin(activity: Activity, url: String) {
WordPress/src/main/java/org/wordpress/android/ui/ActivityNavigator.kt
Outdated
Show resolved
Hide resolved
...ress/src/main/java/org/wordpress/android/ui/accounts/login/ApplicationPasswordLoginHelper.kt
Show resolved
Hide resolved
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.
Changes look good! I left a couple of comments which you may or may not want to address.
Thank you for the suggestions. I've now made the changes, so it should be ready to go :) |
…-flow-to-allow-Application-Password
…-flow-to-allow-Application-Password
|
Description
This PR is the first iteration to add the ability to use the Application Password login as the main login entry point when a user tries to log into a new self-hosted site.
Note: this PR is not using those credentials yet, it's just offering the option and storing them into an existing site
Testing instructions
Screen_recording_20250527_180852.mp4
Please do other smoke tests to discover possible bugs