From 2058d9743c580e452106ff87b932387cf2dfc930 Mon Sep 17 00:00:00 2001 From: Hicham Boushaba Date: Tue, 13 Aug 2024 17:08:37 +0100 Subject: [PATCH 1/2] Show the SMS button when no auth types are provided --- .../org/wordpress/android/login/Login2FaFragment.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libs/login/src/main/java/org/wordpress/android/login/Login2FaFragment.java b/libs/login/src/main/java/org/wordpress/android/login/Login2FaFragment.java index 5fc4ecdbd3b..cda982c77de 100644 --- a/libs/login/src/main/java/org/wordpress/android/login/Login2FaFragment.java +++ b/libs/login/src/main/java/org/wordpress/android/login/Login2FaFragment.java @@ -1,5 +1,7 @@ package org.wordpress.android.login; +import static android.content.Context.CLIPBOARD_SERVICE; + import android.content.ClipboardManager; import android.content.Context; import android.os.Bundle; @@ -53,8 +55,6 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; -import static android.content.Context.CLIPBOARD_SERVICE; - import dagger.android.support.AndroidSupportInjection; public class Login2FaFragment extends LoginBaseFormFragment implements TextWatcher, @@ -208,7 +208,9 @@ protected void setupContent(ViewGroup rootView) { // restrict the allowed input chars to just numbers m2FaInput.getEditText().setKeyListener(DigitsKeyListener.getInstance("0123456789")); - boolean isSmsEnabled = mSupportedAuthTypes.contains(SupportedAuthTypes.PUSH); + // If we didn't get a list of supported auth types, then the flow is not using webauthn, + // We should treat it as if SMS is enabled for the user + boolean isSmsEnabled = mSupportedAuthTypes.isEmpty() || mSupportedAuthTypes.contains(SupportedAuthTypes.PUSH); mOtpButton = rootView.findViewById(R.id.login_otp_button); mOtpButton.setVisibility(isSmsEnabled ? View.VISIBLE : View.GONE); mOtpButton.setText(mSentSmsCode ? R.string.login_text_otp_another : R.string.login_text_otp); From 7d85541693a51e66a80120b066b13771da47fa12 Mon Sep 17 00:00:00 2001 From: Hicham Boushaba Date: Thu, 15 Aug 2024 10:29:32 +0100 Subject: [PATCH 2/2] Remove unused variable --- .../main/java/org/wordpress/android/login/Login2FaFragment.java | 1 - 1 file changed, 1 deletion(-) diff --git a/libs/login/src/main/java/org/wordpress/android/login/Login2FaFragment.java b/libs/login/src/main/java/org/wordpress/android/login/Login2FaFragment.java index cda982c77de..f35e4e8c2f9 100644 --- a/libs/login/src/main/java/org/wordpress/android/login/Login2FaFragment.java +++ b/libs/login/src/main/java/org/wordpress/android/login/Login2FaFragment.java @@ -132,7 +132,6 @@ public static Login2FaFragment newInstance(String emailAddress, String password, String userId, String webauthnNonce, String authenticatorNonce, String backupNonce, String smsNonce, List authTypes) { - boolean supportsWebauthn = webauthnNonce != null && !webauthnNonce.isEmpty(); Login2FaFragment fragment = new Login2FaFragment(); Bundle args = new Bundle(); args.putString(ARG_EMAIL_ADDRESS, emailAddress);