-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Discover the login url for self-hosted sites and log it #21851
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
Discover the login url for self-hosted sites and log it #21851
Conversation
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 a new mechanism to discover and log the authorization URL for self-hosted sites during the login process.
- Adds a new LoginSiteAddressViewModel with API discovery logic.
- Integrates the view model into the LoginSiteAddressFragment.
- Updates dependency injection modules to bind the new view model and provide a singleton WpLoginClient.
Reviewed Changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
libs/login/src/main/java/org/wordpress/android/login/viewmodel/LoginSiteAddressViewModel.kt | Implements API discovery and logs the discovered authorization URL. |
libs/login/src/main/java/org/wordpress/android/login/LoginSiteAddressFragment.kt | Initializes the new view model and invokes the API discovery. |
WordPress/src/main/java/org/wordpress/android/modules/ViewModelModule.java | Adds binding for LoginSiteAddressViewModel. |
WordPress/src/main/java/org/wordpress/android/modules/ApplicationModule.java | Provides a singleton instance of WpLoginClient. |
Files not reviewed (1)
- libs/login/build.gradle: Language not supported
libs/login/src/main/java/org/wordpress/android/login/viewmodel/LoginSiteAddressViewModel.kt
Show resolved
Hide resolved
Generated by 🚫 Danger |
|
App Name | ![]() |
|
Flavor | Jalapeno | |
Build Type | Debug | |
Version | pr21851-2f68298 | |
Commit | 2f68298 | |
Direct Download | jetpack-prototype-build-pr21851-2f68298.apk |
|
App Name | ![]() |
|
Flavor | Jalapeno | |
Build Type | Debug | |
Version | pr21851-2f68298 | |
Commit | 2f68298 | |
Direct Download | wordpress-prototype-build-pr21851-2f68298.apk |
…r-the-login-url-and-log-it
val authorizationUrl = urlDiscovery.apiDetails.findApplicationPasswordsAuthenticationUrl() | ||
Log.d("WP_RS", "VM: Found authorization URL: $authorizationUrl") | ||
} catch (throwable: Throwable) { | ||
Log.e("WP_RS", "VM: Error during API discovery", throwable) |
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.
I'm wondering if we should include the passed url in the log message?
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.
This logic is not gonna exist in the way it is in the next iteration. The logging is actually just to check the PR, so I don't think it's necessary.
@@ -190,6 +198,8 @@ class LoginSiteAddressFragment : LoginBaseDiscoveryFragment(), TextWatcher, OnEd | |||
|
|||
val cleanedUrl = stripKnownPaths(requestedSiteAddress.orEmpty()) | |||
|
|||
viewModel.runApiDiscovery(cleanedUrl) |
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.
Nitpick: maybe add a comment that this is a work-in-progress and isn't really used yet?
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.
Done!
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 are good, merge when ready!
|
Description
This PR is discovering the password login url for a site and logging it
Testing instructions