disable password edit unless unauthorized
This commit is contained in:
parent
0051cd3452
commit
fcfbe58343
2 changed files with 6 additions and 3 deletions
|
@ -49,8 +49,6 @@ import eu.siacs.conversations.xmpp.XmppConnection;
|
|||
import eu.siacs.conversations.xmpp.jingle.RtpCapability;
|
||||
import eu.siacs.conversations.crypto.sasl.ChannelBinding;
|
||||
import eu.siacs.conversations.crypto.sasl.SaslMechanism;
|
||||
import eu.siacs.conversations.crypto.sasl.ScramPlusMechanism;
|
||||
|
||||
public class Account extends AbstractEntity implements AvatarService.Avatarable {
|
||||
|
||||
public static final String TABLENAME = "accounts";
|
||||
|
@ -368,6 +366,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;
|
||||
}
|
||||
|
|
|
@ -1307,7 +1307,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);
|
||||
this.binding.accountPassword.setFocusable(editPassword);
|
||||
this.binding.accountPassword.setFocusableInTouchMode(editPassword);
|
||||
|
|
Loading…
Add table
Reference in a new issue