aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2018-12-27 20:34:59 +0100
committerChristian Schneppe <christian@pix-art.de>2018-12-27 20:34:59 +0100
commit9e10915d8b546a0eb7482401364c91a58ce57a3d (patch)
tree4af74621a9e1944bd1d3272443cecb8a8ea0e3ac
parent7ff09db9114bbe9fb3c9aa637a71d7a1444dd895 (diff)
show accept button to confirm sasl downgrade
-rw-r--r--src/main/java/de/pixart/messenger/ui/EditAccountActivity.java15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java b/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java
index bb579b8f1..123591b03 100644
--- a/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java
@@ -139,6 +139,13 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
}
return;
}
+ if (inNeedOfSaslAccept()) {
+ mAccount.setKey(Account.PINNED_MECHANISM_KEY, String.valueOf(-1));
+ if (!xmppConnectionService.updateAccount(mAccount)) {
+ Toast.makeText(EditAccountActivity.this, R.string.unable_to_update_account, Toast.LENGTH_SHORT).show();
+ }
+ return;
+ }
final boolean openRegistrationUrl = registerNewAccount && !accountInfoEdited && mAccount != null && mAccount.getStatus() == Account.State.REGISTRATION_WEB;
final boolean openPaymentUrl = mAccount != null && mAccount.getStatus() == Account.State.PAYMENT_REQUIRED;
final boolean redirectionWorthyStatus = openPaymentUrl || openRegistrationUrl;
@@ -510,6 +517,8 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
URL url = connection != null && mAccount.getStatus() == Account.State.PAYMENT_REQUIRED ? connection.getRedirectionUrl() : null;
if (url != null) {
this.binding.saveButton.setText(R.string.open_website);
+ } else if (inNeedOfSaslAccept()) {
+ this.binding.saveButton.setText(R.string.accept);
} else {
this.binding.saveButton.setText(R.string.connect);
}
@@ -847,6 +856,10 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
return super.onOptionsItemSelected(item);
}
+ private boolean inNeedOfSaslAccept() {
+ return mAccount != null && mAccount.getLastErrorStatus() == Account.State.DOWNGRADE_ATTACK && mAccount.getKeyAsInt(Account.PINNED_MECHANISM_KEY, -1) >= 0 && !accountInfoEdited();
+ }
+
private void publishOpenPGPPublicKey(Account account) {
if (EditAccountActivity.this.hasPgp()) {
announcePgp(account, null, null, onOpenPGPKeyPublished);
@@ -1171,7 +1184,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
} else {
final TextInputLayout errorLayout;
if (this.mAccount.errorStatus()) {
- if (this.mAccount.getStatus() == Account.State.UNAUTHORIZED) {
+ if (this.mAccount.getStatus() == Account.State.UNAUTHORIZED || this.mAccount.getStatus() == Account.State.DOWNGRADE_ATTACK) {
errorLayout = this.binding.accountPasswordLayout;
} else if (mShowOptions
&& this.mAccount.getStatus() == Account.State.SERVER_NOT_FOUND