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..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 @@ -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, @@ -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); @@ -208,7 +207,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);