mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-20 13:17:08 +00:00
Added auth disable debug options
This commit is contained in:
parent
b96fd267f6
commit
6f94f223dc
4 changed files with 60 additions and 3 deletions
|
@ -145,11 +145,19 @@ public class EmailService implements AutoCloseable {
|
||||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
this.harden = prefs.getBoolean("ssl_harden", false);
|
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);
|
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.scope", "folder");
|
||||||
properties.put("mail.event.executor", executor);
|
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");
|
properties.put("mail." + protocol + ".sasl.enable", "true");
|
||||||
if (auth_sasl) {
|
if (auth_sasl) {
|
||||||
properties.put("mail." + protocol + ".sasl.mechanisms", "CRAM-MD5");
|
properties.put("mail." + protocol + ".sasl.mechanisms", "CRAM-MD5");
|
||||||
|
|
|
@ -80,6 +80,8 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
||||||
private SwitchCompat swCrashReports;
|
private SwitchCompat swCrashReports;
|
||||||
private TextView tvUuid;
|
private TextView tvUuid;
|
||||||
private SwitchCompat swDebug;
|
private SwitchCompat swDebug;
|
||||||
|
private SwitchCompat swAuthPlain;
|
||||||
|
private SwitchCompat swAuthLogin;
|
||||||
private SwitchCompat swAuthSasl;
|
private SwitchCompat swAuthSasl;
|
||||||
private Button btnReset;
|
private Button btnReset;
|
||||||
private SwitchCompat swCleanupAttachments;
|
private SwitchCompat swCleanupAttachments;
|
||||||
|
@ -99,7 +101,8 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
||||||
|
|
||||||
private final static String[] RESET_OPTIONS = new String[]{
|
private final static String[] RESET_OPTIONS = new String[]{
|
||||||
"shortcuts", "fts", "english", "watchdog", "updates",
|
"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[]{
|
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);
|
swCrashReports = view.findViewById(R.id.swCrashReports);
|
||||||
tvUuid = view.findViewById(R.id.tvUuid);
|
tvUuid = view.findViewById(R.id.tvUuid);
|
||||||
swDebug = view.findViewById(R.id.swDebug);
|
swDebug = view.findViewById(R.id.swDebug);
|
||||||
|
swAuthPlain = view.findViewById(R.id.swAuthPlain);
|
||||||
|
swAuthLogin = view.findViewById(R.id.swAuthLogin);
|
||||||
swAuthSasl = view.findViewById(R.id.swAuthSasl);
|
swAuthSasl = view.findViewById(R.id.swAuthSasl);
|
||||||
btnReset = view.findViewById(R.id.btnReset);
|
btnReset = view.findViewById(R.id.btnReset);
|
||||||
swCleanupAttachments = view.findViewById(R.id.swCleanupAttachments);
|
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() {
|
swAuthSasl.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
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));
|
swCrashReports.setChecked(prefs.getBoolean("crash_reports", false));
|
||||||
tvUuid.setText(prefs.getString("uuid", null));
|
tvUuid.setText(prefs.getString("uuid", null));
|
||||||
swDebug.setChecked(prefs.getBoolean("debug", false));
|
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));
|
swAuthSasl.setChecked(prefs.getBoolean("auth_sasl", true));
|
||||||
swCleanupAttachments.setChecked(prefs.getBoolean("cleanup_attachments", false));
|
swCleanupAttachments.setChecked(prefs.getBoolean("cleanup_attachments", false));
|
||||||
|
|
||||||
|
|
|
@ -266,6 +266,30 @@
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/swDebug" />
|
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
|
<androidx.appcompat.widget.SwitchCompat
|
||||||
android:id="@+id/swAuthSasl"
|
android:id="@+id/swAuthSasl"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
@ -275,7 +299,7 @@
|
||||||
android:text="@string/title_advanced_auth_sasl"
|
android:text="@string/title_advanced_auth_sasl"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/tvDebugHint"
|
app:layout_constraintTop_toBottomOf="@id/swAuthLogin"
|
||||||
app:switchPadding="12dp" />
|
app:switchPadding="12dp" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
|
@ -430,6 +454,6 @@
|
||||||
android:id="@+id/grpDebug"
|
android:id="@+id/grpDebug"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="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>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
</eu.faircode.email.ScrollViewEx>
|
</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_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_english">Use US country settings</string>
|
||||||
<string name="title_advanced_watchdog">Periodically check if FairEmail is still active</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_auth_sasl" translatable="false">SASL</string>
|
||||||
<string name="title_advanced_optimize">Automatically optimize</string>
|
<string name="title_advanced_optimize">Automatically optimize</string>
|
||||||
<string name="title_advanced_updates">Check for updates</string>
|
<string name="title_advanced_updates">Check for updates</string>
|
||||||
|
|
Loading…
Reference in a new issue