disable password edit unless unauthorized
This commit is contained in:
parent
3350ea8b5b
commit
1b49e6b3c1
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue