jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/369967 )
Change subject: Fix: Check for 2FA response type before displaying a 2FA prompt
......................................................................
Fix: Check for 2FA response type before displaying a 2FA prompt
Bug: T170791
Change-Id: I432a0e21092f3fde4f428d24559e04296f01582c
---
M app/src/main/java/org/wikipedia/login/LoginClient.java
1 file changed, 9 insertions(+), 6 deletions(-)
Approvals:
Dbrant: Looks good to me, approved
jenkins-bot: Verified
diff --git a/app/src/main/java/org/wikipedia/login/LoginClient.java
b/app/src/main/java/org/wikipedia/login/LoginClient.java
index 798bdd6..f4a4df5 100644
--- a/app/src/main/java/org/wikipedia/login/LoginClient.java
+++ b/app/src/main/java/org/wikipedia/login/LoginClient.java
@@ -89,8 +89,11 @@
String actualUserName = loginResult.getUserName();
getExtendedInfo(wiki, actualUserName, loginResult, cb);
} else if ("UI".equals(loginResult.getStatus())) {
- //TODO: Don't just assume this is a 2FA UI result
- cb.twoFactorPrompt(new
LoginFailedException(loginResult.getMessage()), loginToken);
+ if (loginResult instanceof LoginOAuthResult) {
+ cb.twoFactorPrompt(new
LoginFailedException(loginResult.getMessage()), loginToken);
+ } else {
+ cb.error(new
LoginFailedException(loginResult.getMessage()));
+ }
} else {
cb.error(new
LoginFailedException(loginResult.getMessage()));
}
@@ -187,10 +190,10 @@
}
private static class ClientLogin {
- @SerializedName("status") private String status;
- @Nullable private List<Request> requests;
- @SerializedName("message") @Nullable private String message;
- @SerializedName("username") @Nullable private String userName;
+ @SuppressWarnings("unused,NullableProblems") @NonNull private
String status;
+ @SuppressWarnings("unused") @Nullable private List<Request>
requests;
+ @SuppressWarnings("unused") @Nullable private String message;
+ @SuppressWarnings("unused") @SerializedName("username") @Nullable
private String userName;
LoginResult toLoginResult(@NonNull WikiSite site, @NonNull String
password) {
String userMessage = message;
--
To view, visit https://gerrit.wikimedia.org/r/369967
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I432a0e21092f3fde4f428d24559e04296f01582c
Gerrit-PatchSet: 2
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Mholloway <[email protected]>
Gerrit-Reviewer: Brion VIBBER <[email protected]>
Gerrit-Reviewer: Dbrant <[email protected]>
Gerrit-Reviewer: Mholloway <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits