diff --git a/app/src/main/java/eu/faircode/email/EmailService.java b/app/src/main/java/eu/faircode/email/EmailService.java index ec61ef7322..9d63c73032 100644 --- a/app/src/main/java/eu/faircode/email/EmailService.java +++ b/app/src/main/java/eu/faircode/email/EmailService.java @@ -179,8 +179,13 @@ public class EmailService implements AutoCloseable { boolean auth_plain = prefs.getBoolean("auth_plain", true); boolean auth_login = prefs.getBoolean("auth_login", true); + boolean auth_ntlm = prefs.getBoolean("auth_ntlm", true); boolean auth_sasl = prefs.getBoolean("auth_sasl", true); - Log.i("Authenticate plain=" + auth_plain + " login=" + auth_login + " sasl=" + auth_sasl); + Log.i("Authenticate" + + " plain=" + auth_plain + + " login=" + auth_login + + " ntlm=" + auth_ntlm + + " sasl=" + auth_sasl); properties.put("mail.event.scope", "folder"); properties.put("mail.event.executor", executor); @@ -189,6 +194,8 @@ public class EmailService implements AutoCloseable { properties.put("mail." + protocol + ".auth.plain.disable", "true"); if (!auth_login) properties.put("mail." + protocol + ".auth.login.disable", "true"); + if (!auth_ntlm) + properties.put("mail." + protocol + ".auth.ntlm.disable", "true"); // SASL is attempted before other authentication methods properties.put("mail." + protocol + ".sasl.enable", Boolean.toString(auth_sasl)); diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java b/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java index 84b9b55a44..3f28efb659 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java @@ -111,6 +111,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc private SwitchCompat swDebug; private SwitchCompat swAuthPlain; private SwitchCompat swAuthLogin; + private SwitchCompat swAuthNtlm; private SwitchCompat swAuthSasl; private TextView tvProcessors; private TextView tvMemoryClass; @@ -132,7 +133,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc "classification", "class_min_probability", "class_min_difference", "language", "watchdog", "updates", "experiments", "query_threads", "crash_reports", "cleanup_attachments", - "protocol", "debug", "auth_plain", "auth_login", "auth_sasl" + "protocol", "debug", "auth_plain", "auth_login", "auth_ntlm", "auth_sasl" }; private final static String[] RESET_QUESTIONS = new String[]{ @@ -201,6 +202,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc swDebug = view.findViewById(R.id.swDebug); swAuthPlain = view.findViewById(R.id.swAuthPlain); swAuthLogin = view.findViewById(R.id.swAuthLogin); + swAuthNtlm = view.findViewById(R.id.swAuthNtlm); swAuthSasl = view.findViewById(R.id.swAuthSasl); tvProcessors = view.findViewById(R.id.tvProcessors); tvMemoryClass = view.findViewById(R.id.tvMemoryClass); @@ -481,6 +483,13 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc } }); + swAuthNtlm.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { + prefs.edit().putBoolean("auth_ntlm", checked).apply(); + } + }); + swAuthSasl.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { @@ -840,6 +849,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc swDebug.setChecked(prefs.getBoolean("debug", false)); swAuthPlain.setChecked(prefs.getBoolean("auth_plain", true)); swAuthLogin.setChecked(prefs.getBoolean("auth_login", true)); + swAuthNtlm.setChecked(prefs.getBoolean("auth_ntlm", true)); swAuthSasl.setChecked(prefs.getBoolean("auth_sasl", true)); tvProcessors.setText(getString(R.string.title_advanced_processors, Runtime.getRuntime().availableProcessors())); diff --git a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java index c7a557177b..30b8c83d5e 100644 --- a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java +++ b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java @@ -148,9 +148,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences "prefer_ip4", "standalone_vpn", "tcp_keep_alive", "ssl_harden", // force reconnect "badge", "unseen_ignored", // force update badge/widget "experiments", "debug", "protocol", // force reconnect - "auth_plain", - "auth_login", - "auth_sasl" + "auth_plain", "auth_login", "auth_ntlm", "auth_sasl" // force reconnect )); static final int PI_ALARM = 1; diff --git a/app/src/main/res/layout/fragment_options_misc.xml b/app/src/main/res/layout/fragment_options_misc.xml index c0bf16c6ad..797ece635f 100644 --- a/app/src/main/res/layout/fragment_options_misc.xml +++ b/app/src/main/res/layout/fragment_options_misc.xml @@ -504,6 +504,18 @@ app:layout_constraintTop_toBottomOf="@id/swAuthPlain" app:switchPadding="12dp" /> + + + app:constraint_referenced_ids="swAuthPlain,swAuthLogin,swAuthNtlm,swAuthSasl,tvProcessors,tvMemoryClass,tvMemoryUsage,tvStorageUsage,tvFingerprint,btnCharsets,btnCiphers,btnFiles" /> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 7440db97ef..8ca567e9f3 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -527,6 +527,7 @@ Periodically check if FairEmail is still active PLAIN LOGIN + NTLM SASL Automatically optimize Check for GitHub updates