Added option to disable SASL authentication

pull/180/head
M66B 4 years ago
parent 5bc040a3f3
commit 18011bb9ed

@ -142,6 +142,8 @@ public class EmailService implements AutoCloseable {
boolean socks_enabled = prefs.getBoolean("socks_enabled", false);
String socks_proxy = prefs.getString("socks_proxy", "localhost:9050");
boolean sasl = prefs.getBoolean("sasl", true);
// SOCKS proxy
if (socks_enabled) {
String[] address = socks_proxy.split(":");
@ -160,8 +162,10 @@ public class EmailService implements AutoCloseable {
properties.put("mail.event.executor", executor);
properties.put("mail." + protocol + ".sasl.enable", "true");
properties.put("mail." + protocol + ".sasl.mechanisms", "CRAM-MD5");
properties.put("mail." + protocol + ".sasl.realm", realm == null ? "" : realm);
if (sasl) {
properties.put("mail." + protocol + ".sasl.mechanisms", "CRAM-MD5");
properties.put("mail." + protocol + ".sasl.realm", realm == null ? "" : realm);
}
properties.put("mail." + protocol + ".auth.ntlm.domain", realm == null ? "" : realm);
// writetimeout: one thread overhead

@ -70,6 +70,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
private TextView tvFtsPro;
private SwitchCompat swEnglish;
private SwitchCompat swWatchdog;
private SwitchCompat swSasl;
private SwitchCompat swOptimize;
private SwitchCompat swUpdates;
private SwitchCompat swExperiments;
@ -93,7 +94,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
private Group grpDebug;
private final static String[] RESET_OPTIONS = new String[]{
"shortcuts", "fts", "english", "watchdog", "auto_optimize", "updates",
"shortcuts", "fts", "english", "watchdog", "sasl", "auto_optimize", "updates",
"experiments", "crash_reports", "debug", "cleanup_attachments"
};
@ -124,6 +125,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
tvFtsPro = view.findViewById(R.id.tvFtsPro);
swEnglish = view.findViewById(R.id.swEnglish);
swWatchdog = view.findViewById(R.id.swWatchdog);
swSasl = view.findViewById(R.id.swSasl);
swOptimize = view.findViewById(R.id.swOptimize);
swUpdates = view.findViewById(R.id.swUpdates);
swExperiments = view.findViewById(R.id.swExperiments);
@ -223,6 +225,14 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
}
});
swSasl.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("sasl", checked).apply();
ServiceSynchronize.reload(getContext(), -1L, false, "sasl=" + checked);
}
});
swOptimize.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -508,6 +518,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
swFts.setChecked(prefs.getBoolean("fts", false));
swEnglish.setChecked(prefs.getBoolean("english", false));
swWatchdog.setChecked(prefs.getBoolean("watchdog", true));
swSasl.setChecked(prefs.getBoolean("sasl", true));
swOptimize.setChecked(prefs.getBoolean("auto_optimize", false));
swUpdates.setChecked(prefs.getBoolean("updates", true));
swUpdates.setVisibility(

@ -146,6 +146,18 @@
app:layout_constraintTop_toBottomOf="@id/tvEnglishHint"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swSasl"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:checked="true"
android:text="@string/title_advanced_sasl"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swWatchdog"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swOptimize"
android:layout_width="0dp"
@ -155,7 +167,7 @@
android:text="@string/title_advanced_optimize"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swWatchdog"
app:layout_constraintTop_toBottomOf="@id/swSasl"
app:switchPadding="12dp" />
<eu.faircode.email.FixedTextView

@ -449,6 +449,7 @@
<string name="title_advanced_fts_indexed">%1$d / %2$d messages indexed (%3$s)</string>
<string name="title_advanced_english">Use US country settings</string>
<string name="title_advanced_watchdog">Periodically check if FairEmail is still active</string>
<string name="title_advanced_sasl" translatable="false">CRAM-MD5</string>
<string name="title_advanced_optimize">Automatically optimize settings</string>
<string name="title_advanced_updates">Check for updates</string>
<string name="title_advanced_experiments">Try experimental features</string>

Loading…
Cancel
Save