Add security error status

This commit is contained in:
Sam Whited 2014-11-15 11:19:42 -05:00
parent d94b07c916
commit c09d450db8
4 changed files with 22 additions and 13 deletions

View file

@ -52,7 +52,8 @@ public class Account extends AbstractEntity {
REGISTRATION_FAILED(true), REGISTRATION_FAILED(true),
REGISTRATION_CONFLICT(true), REGISTRATION_CONFLICT(true),
REGISTRATION_SUCCESSFUL, REGISTRATION_SUCCESSFUL,
REGISTRATION_NOT_SUPPORTED(true); REGISTRATION_NOT_SUPPORTED(true),
SECURITY_ERROR(true);
private boolean isError; private boolean isError;
@ -92,6 +93,8 @@ public class Account extends AbstractEntity {
return R.string.account_status_regis_success; return R.string.account_status_regis_success;
case REGISTRATION_NOT_SUPPORTED: case REGISTRATION_NOT_SUPPORTED:
return R.string.account_status_regis_not_sup; return R.string.account_status_regis_not_sup;
case SECURITY_ERROR:
return R.string.account_status_security_error;
default: default:
return R.string.account_status_unknown; return R.string.account_status_unknown;
} }

View file

@ -92,6 +92,10 @@ public class AccountAdapter extends ArrayAdapter<Account> {
R.string.account_status_regis_not_sup)); R.string.account_status_regis_not_sup));
statusView.setTextColor(activity.getWarningTextColor()); statusView.setTextColor(activity.getWarningTextColor());
break; break;
case SECURITY_ERROR:
statusView.setText(getContext().getString
(R.string.account_status_security_error));
statusView.setTextColor(activity.getWarningTextColor());
default: default:
statusView.setText(""); statusView.setText("");
break; break;

View file

@ -649,6 +649,7 @@ public class XmppConnection implements Runnable {
") than pinned priority (" + keys.getInt(Account.PINNED_MECHANISM_KEY) + ") than pinned priority (" + keys.getInt(Account.PINNED_MECHANISM_KEY) +
"). Possible downgrade attack?"); "). Possible downgrade attack?");
disconnect(true); disconnect(true);
account.setStatus(Account.State.SECURITY_ERROR);
} }
} catch (final JSONException e) { } catch (final JSONException e) {
Log.d(Config.LOGTAG, "Parse error while checking pinned auth mechanism"); Log.d(Config.LOGTAG, "Parse error while checking pinned auth mechanism");

View file

@ -141,6 +141,7 @@
<string name="account_status_regis_conflict">Username already in use</string> <string name="account_status_regis_conflict">Username already in use</string>
<string name="account_status_regis_success">Registration completed</string> <string name="account_status_regis_success">Registration completed</string>
<string name="account_status_regis_not_sup">Server does not support registration</string> <string name="account_status_regis_not_sup">Server does not support registration</string>
<string name="account_status_security_error">Security error</string>
<string name="encryption_choice_none">Plain text</string> <string name="encryption_choice_none">Plain text</string>
<string name="encryption_choice_otr">OTR</string> <string name="encryption_choice_otr">OTR</string>
<string name="encryption_choice_pgp">OpenPGP</string> <string name="encryption_choice_pgp">OpenPGP</string>