reset fast token on login failure

This commit is contained in:
Daniel Gultsch 2022-11-01 16:44:05 +01:00
parent 6e562d4cf9
commit 35ee01cb28
2 changed files with 10 additions and 1 deletions

View file

@ -362,6 +362,11 @@ public class Account extends AbstractEntity implements AvatarService.Avatarable
this.fastToken = token;
}
public void resetFastToken() {
this.fastMechanism = null;
this.fastToken = null;
}
public void resetPinnedMechanism() {
this.pinnedMechanism = null;
this.pinnedChannelBinding = null;

View file

@ -840,7 +840,11 @@ public class XmppConnection implements Runnable {
}
Log.d(Config.LOGTAG,failure.toString());
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": login failure " + version);
//TODO check if we are doing FAST; reset token
if (this.saslMechanism instanceof HashedToken) {
Log.d(Config.LOGTAG,account.getJid().asBareJid() + ": resetting token");
account.resetFastToken();
mXmppConnectionService.databaseBackend.updateAccount(account);
}
if (failure.hasChild("temporary-auth-failure")) {
throw new StateChangingException(Account.State.TEMPORARY_AUTH_FAILURE);
} else if (failure.hasChild("account-disabled")) {