1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-25 01:06:04 +00:00

Improved switching to password

This commit is contained in:
M66B 2022-04-17 13:34:38 +02:00
parent 31a215d92b
commit 03bb67b7d0

View file

@ -680,6 +680,11 @@ public class FragmentAccount extends FragmentBase {
saving = false;
invalidateOptionsMenu();
Helper.setViewsEnabled(view, true);
if (auth != AUTH_TYPE_PASSWORD) {
etUser.setEnabled(false);
tilPassword.getEditText().setEnabled(false);
btnCertificate.setEnabled(false);
}
pbCheck.setVisibility(View.GONE);
}
@ -720,11 +725,6 @@ public class FragmentAccount extends FragmentBase {
result.account = db.account().getAccount(id);
result.folders = new ArrayList<>();
if (result.account != null &&
result.account.auth_type != AUTH_TYPE_PASSWORD &&
!Objects.equals(result.account.password, password))
auth = AUTH_TYPE_PASSWORD;
// Check IMAP server / get folders
String protocol = "imap" + (encryption == EmailService.ENCRYPTION_SSL ? "s" : "");
try (EmailService iservice = new EmailService(
@ -911,6 +911,11 @@ public class FragmentAccount extends FragmentBase {
saving = false;
invalidateOptionsMenu();
Helper.setViewsEnabled(view, true);
if (auth != AUTH_TYPE_PASSWORD) {
etUser.setEnabled(false);
tilPassword.getEditText().setEnabled(false);
btnCertificate.setEnabled(false);
}
pbSave.setVisibility(View.GONE);
}
@ -989,11 +994,6 @@ public class FragmentAccount extends FragmentBase {
DB db = DB.getInstance(context);
EntityAccount account = db.account().getAccount(id);
if (account != null &&
account.auth_type != AUTH_TYPE_PASSWORD &&
!Objects.equals(account.password, password))
auth = AUTH_TYPE_PASSWORD;
if (should) {
if (account == null)
return !TextUtils.isEmpty(host) && !TextUtils.isEmpty(user);
@ -1641,8 +1641,11 @@ public class FragmentAccount extends FragmentBase {
}
private void onPassword() {
auth = AUTH_TYPE_PASSWORD;
etUser.setEnabled(true);
tilPassword.getEditText().setText(null);
tilPassword.getEditText().setEnabled(true);
tilPassword.setEndIconMode(END_ICON_PASSWORD_TOGGLE);
tilPassword.requestFocus();
}
});