mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 12:53:55 +01:00
Wrap 2fa auth in DEBUG checks
Currently although you can log in with 2fa things break after than. All of the auth code needs a bit of love to sort this out.
This commit is contained in:
parent
eb58a847b1
commit
904ea4554e
2 changed files with 9 additions and 3 deletions
|
|
@ -17,6 +17,7 @@ import android.widget.EditText;
|
|||
import android.widget.TextView;
|
||||
|
||||
import android.widget.Toast;
|
||||
import fr.free.nrw.commons.BuildConfig;
|
||||
import fr.free.nrw.commons.R;
|
||||
import fr.free.nrw.commons.Utils;
|
||||
import fr.free.nrw.commons.WelcomeActivity;
|
||||
|
|
@ -81,7 +82,7 @@ public class LoginActivity extends AccountAuthenticatorActivity {
|
|||
if(
|
||||
usernameEdit.getText().length() != 0 &&
|
||||
passwordEdit.getText().length() != 0 &&
|
||||
( twoFactorEdit.getText().length() != 0 || twoFactorEdit.getVisibility() != View.VISIBLE )
|
||||
( BuildConfig.DEBUG || twoFactorEdit.getText().length() != 0 || twoFactorEdit.getVisibility() != View.VISIBLE )
|
||||
) {
|
||||
loginButton.setEnabled(true);
|
||||
} else {
|
||||
|
|
@ -179,8 +180,12 @@ public class LoginActivity extends AccountAuthenticatorActivity {
|
|||
}
|
||||
|
||||
public void askUserForTwoFactorAuth() {
|
||||
twoFactorEdit.setVisibility(View.VISIBLE);
|
||||
showUserToastAndCancelDialog( R.string.login_failed_2fa_needed );
|
||||
if(BuildConfig.DEBUG) {
|
||||
twoFactorEdit.setVisibility(View.VISIBLE);
|
||||
showUserToastAndCancelDialog( R.string.login_failed_2fa_needed );
|
||||
}else{
|
||||
showUserToastAndCancelDialog( R.string.login_failed_2fa_not_supported );
|
||||
}
|
||||
}
|
||||
|
||||
public void showUserToastAndCancelDialog( int resId ) {
|
||||
|
|
|
|||
|
|
@ -178,5 +178,6 @@ Tap this message (or hit back) to skip this step.</string>
|
|||
<string name="maximum_limit">Maximum Limit</string>
|
||||
<string name="maximum_limit_alert">Maximum limit should be 500</string>
|
||||
<string name="set_limit">Set Recent Upload Limit</string>
|
||||
<string name="login_failed_2fa_not_supported">Two factor authentication is currently not supported.</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue