disable password edit unless unauthorized

This commit is contained in:
Daniel Gultsch 2023-10-15 11:23:12 +02:00
parent 3350ea8b5b
commit 1b49e6b3c1
No known key found for this signature in database
GPG key ID: F43D18AD2A0982C2
2 changed files with 6 additions and 2 deletions

View file

@ -31,7 +31,6 @@ import eu.siacs.conversations.crypto.sasl.HashedToken;
import eu.siacs.conversations.crypto.sasl.HashedTokenSha256;
import eu.siacs.conversations.crypto.sasl.HashedTokenSha512;
import eu.siacs.conversations.crypto.sasl.SaslMechanism;
import eu.siacs.conversations.crypto.sasl.ScramPlusMechanism;
import eu.siacs.conversations.services.AvatarService;
import eu.siacs.conversations.services.XmppConnectionService;
import eu.siacs.conversations.utils.UIHelper;
@ -328,6 +327,10 @@ public class Account extends AbstractEntity implements AvatarService.Avatarable
}
}
public boolean unauthorized() {
return this.status == State.UNAUTHORIZED || this.lastErrorStatus == State.UNAUTHORIZED;
}
public State getLastErrorStatus() {
return this.lastErrorStatus;
}

View file

@ -1025,7 +1025,8 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
final boolean togglePassword = mAccount.isOptionSet(Account.OPTION_MAGIC_CREATE) || !mAccount.isOptionSet(Account.OPTION_LOGGED_IN_SUCCESSFULLY);
final boolean editPassword = !mAccount.isOptionSet(Account.OPTION_MAGIC_CREATE) || (!mAccount.isOptionSet(Account.OPTION_LOGGED_IN_SUCCESSFULLY) && QuickConversationsService.isConversations()) || mAccount.getLastErrorStatus() == Account.State.UNAUTHORIZED;
final boolean neverLoggedIn = !mAccount.isOptionSet(Account.OPTION_LOGGED_IN_SUCCESSFULLY) && QuickConversationsService.isConversations();
final boolean editPassword = mAccount.unauthorized() || neverLoggedIn;
this.binding.accountPasswordLayout.setPasswordVisibilityToggleEnabled(togglePassword);