Skip to content

Commit

Permalink
Show the SMS button when no auth types are provided
Browse files Browse the repository at this point in the history
  • Loading branch information
hichamboushaba committed Aug 13, 2024
1 parent 94781b4 commit ec97391
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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<LoginListener> implements TextWatcher,
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit ec97391

Please sign in to comment.