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

[Login] Add ability to force using password for login even for passwordless accounts #13202

Draft
wants to merge 3 commits into
base: trunk
Choose a base branch
from

Conversation

hichamboushaba
Copy link
Member

@hichamboushaba hichamboushaba commented Dec 25, 2024

Closes: #13192

Description

This PR adds a build config that allows the app to ignore the "passwordless" property of accounts and force showing the password screen; this helps when debugging some issues; check this discussion p1734946581847499/1734705327.623279-slack-C6H8C3G23 for more information.

Steps to reproduce

  1. If not already done, copy the developer-example.properties file as developer.properties
  2. Change (or add) the property wc.force_password_login = true
  3. Run the app.
  4. Test signing using a passwordless account.

Testing information

  • Confirm that the app shows the password screen even when the account is passwordless.
  • Confirm that removing or setting the property to false restores the default behavior.

The tests that have been performed

^

Images/gif

  • I have considered if this change warrants release notes and have added them to RELEASE-NOTES.txt if necessary. Use the "[Internal]" label for non-user-facing changes.

Reviewer (or Author, in the case of optional code reviews):

Please make sure these conditions are met before approving the PR, or request changes if the PR needs improvement:

  • The PR is small and has a clear, single focus, or a valid explanation is provided in the description. If needed, please request to split it into smaller PRs.
  • Ensure Adequate Unit Test Coverage: The changes are reasonably covered by unit tests or an explanation is provided in the PR description.
  • Manual Testing: The author listed all the tests they ran, including smoke tests when needed (e.g., for refactorings). The reviewer confirmed that the PR works as expected on big (tablet) and small (phone) in case of UI changes, and no regressions are added.

@hichamboushaba hichamboushaba added type: task An internally driven task. feature: login Related to any part of the log in or sign in flow, or authentication. labels Dec 25, 2024
@dangermattic
Copy link
Collaborator

1 Message
📖 This PR is still a Draft: some checks will be skipped.

Generated by 🚫 Danger

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Dec 25, 2024

📲 You can test the changes from this Pull Request in WooCommerce-Wear Android by scanning the QR code below to install the corresponding build.
App Name WooCommerce-Wear Android
Platform⌚️ Wear OS
FlavorJalapeno
Build TypeDebug
Commite500750
Direct Downloadwoocommerce-wear-prototype-build-pr13202-e500750.apk

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Dec 25, 2024

📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.

App Name WooCommerce Android
Platform📱 Mobile
FlavorJalapeno
Build TypeDebug
Commite500750
Direct Downloadwoocommerce-prototype-build-pr13202-e500750.apk

@hichamboushaba hichamboushaba force-pushed the issue/13192-force-password-screen branch from e179e01 to 61128a8 Compare December 26, 2024 09:39
@hichamboushaba hichamboushaba force-pushed the issue/13192-force-password-screen branch from 61128a8 to e500750 Compare December 26, 2024 09:40
import com.woocommerce.android.BuildConfig

@Suppress("SwallowedException")
inline fun <reified T> getBuildConfigValueOrNull(key: String): T? {
Copy link
Member Author

Choose a reason for hiding this comment

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

@wzieba your input would be valuable here, I'm adding a new property to the developer-example.properties, and I don't want to break the build for anyone who already has the file developer.properties locally, as when it exists we'll read the properties only from it, meaning the new property won't be added to the BuildConfig.
As a simple solution for this issue, I added this function here to read the property only when it exists and return null when it doesn't.

But I think there could be a better approach here: Updating the loadPropertiesWithFallback function to load properties from both files with priority given to the main file. We can implement this by starting by loading the default values from the fallback (example) file, then overriding them with the ones from the main one; this will make this logic more resilient to changes to the example file: The developers won't need to update their existing local file unless they need to override a value, WDYT about this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature: login Related to any part of the log in or sign in flow, or authentication. type: task An internally driven task.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Login] Add ability to force showing password screen for passwordless accounts
3 participants