Added auth disable debug options

pull/183/head
M66B 5 years ago
parent b96fd267f6
commit 6f94f223dc

@ -145,11 +145,19 @@ public class EmailService implements AutoCloseable {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
this.harden = prefs.getBoolean("ssl_harden", false);
boolean auth_plain = prefs.getBoolean("auth_plain", true);
boolean auth_login = prefs.getBoolean("auth_login", true);
boolean auth_sasl = prefs.getBoolean("auth_sasl", true);
Log.i("Authenticate plain=" + auth_plain + " login=" + auth_login + " sasl=" + auth_sasl);
properties.put("mail.event.scope", "folder");
properties.put("mail.event.executor", executor);
if (!auth_plain)
properties.put("mail." + protocol + ".auth.plain.disable", "true");
if (!auth_login)
properties.put("mail." + protocol + ".auth.login.disable", "true");
properties.put("mail." + protocol + ".sasl.enable", "true");
if (auth_sasl) {
properties.put("mail." + protocol + ".sasl.mechanisms", "CRAM-MD5");

@ -80,6 +80,8 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
private SwitchCompat swCrashReports;
private TextView tvUuid;
private SwitchCompat swDebug;
private SwitchCompat swAuthPlain;
private SwitchCompat swAuthLogin;
private SwitchCompat swAuthSasl;
private Button btnReset;
private SwitchCompat swCleanupAttachments;
@ -99,7 +101,8 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
private final static String[] RESET_OPTIONS = new String[]{
"shortcuts", "fts", "english", "watchdog", "updates",
"experiments", "query_threads", "crash_reports", "debug", "auth_sasl", "cleanup_attachments"
"experiments", "query_threads", "crash_reports",
"debug", "auth_plain", "auth_login", "auth_sasl", "cleanup_attachments"
};
private final static String[] RESET_QUESTIONS = new String[]{
@ -136,6 +139,8 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
swCrashReports = view.findViewById(R.id.swCrashReports);
tvUuid = view.findViewById(R.id.tvUuid);
swDebug = view.findViewById(R.id.swDebug);
swAuthPlain = view.findViewById(R.id.swAuthPlain);
swAuthLogin = view.findViewById(R.id.swAuthLogin);
swAuthSasl = view.findViewById(R.id.swAuthSasl);
btnReset = view.findViewById(R.id.btnReset);
swCleanupAttachments = view.findViewById(R.id.swCleanupAttachments);
@ -292,6 +297,22 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
}
});
swAuthPlain.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("auth_plain", checked).apply();
ServiceSynchronize.reload(getContext(), -1L, false, "auth_plain=" + checked);
}
});
swAuthLogin.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("auth_login", checked).apply();
ServiceSynchronize.reload(getContext(), -1L, false, "auth_login=" + checked);
}
});
swAuthSasl.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -554,6 +575,8 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
swCrashReports.setChecked(prefs.getBoolean("crash_reports", false));
tvUuid.setText(prefs.getString("uuid", null));
swDebug.setChecked(prefs.getBoolean("debug", false));
swAuthPlain.setChecked(prefs.getBoolean("auth_plain", true));
swAuthLogin.setChecked(prefs.getBoolean("auth_login", true));
swAuthSasl.setChecked(prefs.getBoolean("auth_sasl", true));
swCleanupAttachments.setChecked(prefs.getBoolean("cleanup_attachments", false));

@ -266,6 +266,30 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swDebug" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swAuthPlain"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:checked="true"
android:text="@string/title_advanced_auth_plain"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvDebugHint"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swAuthLogin"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:checked="true"
android:text="@string/title_advanced_auth_login"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swAuthPlain"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swAuthSasl"
android:layout_width="0dp"
@ -275,7 +299,7 @@
android:text="@string/title_advanced_auth_sasl"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvDebugHint"
app:layout_constraintTop_toBottomOf="@id/swAuthLogin"
app:switchPadding="12dp" />
<Button
@ -430,6 +454,6 @@
android:id="@+id/grpDebug"
android:layout_width="0dp"
android:layout_height="0dp"
app:constraint_referenced_ids="swAuthSasl,tvProcessors,tvMemoryClass,tvStorageSpace,tvFingerprint,btnCharsets,btnCiphers" />
app:constraint_referenced_ids="swAuthPlain,swAuthLogin,swAuthSasl,tvProcessors,tvMemoryClass,tvStorageSpace,tvFingerprint,btnCharsets,btnCiphers" />
</androidx.constraintlayout.widget.ConstraintLayout>
</eu.faircode.email.ScrollViewEx>

@ -471,6 +471,8 @@
<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_auth_plain" translatable="false">PLAIN</string>
<string name="title_advanced_auth_login" translatable="false">LOGIN</string>
<string name="title_advanced_auth_sasl" translatable="false">SASL</string>
<string name="title_advanced_optimize">Automatically optimize</string>
<string name="title_advanced_updates">Check for updates</string>

Loading…
Cancel
Save