Revised account/identity setup

pull/147/head
M66B 6 years ago
parent 78d5f588d8
commit ec4e658580

@ -180,8 +180,7 @@ IMAP STARTTLS: the EFF [writes](https://www.eff.org/nl/deeplinks/2018/06/announc
Empty password: your username is likely easily guessed, so this is very insecure. Empty password: your username is likely easily guessed, so this is very insecure.
If you still want to use an invalid security certificate, IMAP STARTTLS or an empty password, If you still want to use an invalid security certificate, IMAP STARTTLS or an empty password,
you'll need to enable insecure connections in the advanced settings and also in the account and/or identity settings. you'll need to enable insecure connections in the account and/or identity settings.
Additionally, IMAP STARTTLS needs to be enabled in the account settings too.
<a name="faq5"></a> <a name="faq5"></a>

@ -29,14 +29,12 @@ import android.app.NotificationManager;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.drawable.GradientDrawable; import android.graphics.drawable.GradientDrawable;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.preference.PreferenceManager;
import android.text.Editable; import android.text.Editable;
import android.text.TextUtils; import android.text.TextUtils;
import android.text.TextWatcher; import android.text.TextWatcher;
@ -157,9 +155,6 @@ public class FragmentAccount extends FragmentEx {
setSubtitle(R.string.title_edit_account); setSubtitle(R.string.title_edit_account);
setHasOptionsMenu(true); setHasOptionsMenu(true);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
final boolean insecure = prefs.getBoolean("insecure", false);
view = (ViewGroup) inflater.inflate(R.layout.fragment_account, container, false); view = (ViewGroup) inflater.inflate(R.layout.fragment_account, container, false);
// Get controls // Get controls
@ -218,8 +213,6 @@ public class FragmentAccount extends FragmentEx {
public void onItemSelected(AdapterView<?> adapterView, View view, int position, long itemid) { public void onItemSelected(AdapterView<?> adapterView, View view, int position, long itemid) {
Provider provider = (Provider) adapterView.getSelectedItem(); Provider provider = (Provider) adapterView.getSelectedItem();
grpServer.setVisibility(position == 1 ? View.VISIBLE : View.GONE); grpServer.setVisibility(position == 1 ? View.VISIBLE : View.GONE);
cbStartTls.setVisibility(position == 1 && insecure ? View.VISIBLE : View.GONE);
cbInsecure.setVisibility(position == 1 && insecure ? View.VISIBLE : View.GONE);
grpAuthorize.setVisibility(position > 0 ? View.VISIBLE : View.GONE); grpAuthorize.setVisibility(position > 0 ? View.VISIBLE : View.GONE);
btnAuthorize.setVisibility(provider.type == null ? View.GONE : View.VISIBLE); btnAuthorize.setVisibility(provider.type == null ? View.GONE : View.VISIBLE);

@ -21,12 +21,10 @@ package eu.faircode.email;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.drawable.GradientDrawable; import android.graphics.drawable.GradientDrawable;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.preference.PreferenceManager;
import android.text.Editable; import android.text.Editable;
import android.text.Html; import android.text.Html;
import android.text.TextUtils; import android.text.TextUtils;
@ -115,6 +113,7 @@ public class FragmentIdentity extends FragmentEx {
private ProgressBar pbSave; private ProgressBar pbSave;
private ProgressBar pbWait; private ProgressBar pbWait;
private Group grpAuthorize;
private Group grpAdvanced; private Group grpAdvanced;
private long id = -1; private long id = -1;
@ -136,9 +135,6 @@ public class FragmentIdentity extends FragmentEx {
setSubtitle(R.string.title_edit_identity); setSubtitle(R.string.title_edit_identity);
setHasOptionsMenu(true); setHasOptionsMenu(true);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
final boolean insecure = prefs.getBoolean("insecure", false);
view = (ViewGroup) inflater.inflate(R.layout.fragment_identity, container, false); view = (ViewGroup) inflater.inflate(R.layout.fragment_identity, container, false);
// Get controls // Get controls
@ -177,6 +173,7 @@ public class FragmentIdentity extends FragmentEx {
pbSave = view.findViewById(R.id.pbSave); pbSave = view.findViewById(R.id.pbSave);
pbWait = view.findViewById(R.id.pbWait); pbWait = view.findViewById(R.id.pbWait);
grpAuthorize = view.findViewById(R.id.grpAuthorize);
grpAdvanced = view.findViewById(R.id.grpAdvanced); grpAdvanced = view.findViewById(R.id.grpAdvanced);
// Wire controls // Wire controls
@ -184,11 +181,10 @@ public class FragmentIdentity extends FragmentEx {
spAccount.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { spAccount.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override @Override
public void onItemSelected(AdapterView<?> adapterView, View view, int position, long id) { public void onItemSelected(AdapterView<?> adapterView, View view, int position, long id) {
btnAdvanced.setVisibility(position > 0 ? View.VISIBLE : View.GONE); grpAuthorize.setVisibility(position > 0 ? View.VISIBLE : View.GONE);
if (position == 0) if (position == 0)
grpAdvanced.setVisibility(View.GONE); grpAdvanced.setVisibility(View.GONE);
tilPassword.setPasswordVisibilityToggleEnabled(position == 0); tilPassword.setPasswordVisibilityToggleEnabled(position == 0);
btnSave.setVisibility(position > 0 ? View.VISIBLE : View.GONE);
Integer tag = (Integer) adapterView.getTag(); Integer tag = (Integer) adapterView.getTag();
if (tag != null && tag.equals(position)) if (tag != null && tag.equals(position))
@ -284,7 +280,6 @@ public class FragmentIdentity extends FragmentEx {
public void onClick(View v) { public void onClick(View v) {
int visibility = (grpAdvanced.getVisibility() == View.VISIBLE ? View.GONE : View.VISIBLE); int visibility = (grpAdvanced.getVisibility() == View.VISIBLE ? View.GONE : View.VISIBLE);
grpAdvanced.setVisibility(visibility); grpAdvanced.setVisibility(visibility);
cbInsecure.setVisibility(insecure ? visibility : View.GONE);
if (visibility == View.VISIBLE) if (visibility == View.VISIBLE)
new Handler().post(new Runnable() { new Handler().post(new Runnable() {
@Override @Override
@ -606,9 +601,11 @@ public class FragmentIdentity extends FragmentEx {
tilPassword.setPasswordVisibilityToggleEnabled(id < 0); tilPassword.setPasswordVisibilityToggleEnabled(id < 0);
btnSave.setVisibility(View.GONE); btnSave.setVisibility(View.GONE);
btnAdvanced.setVisibility(View.GONE); btnAdvanced.setVisibility(View.GONE);
grpAdvanced.setVisibility(View.GONE);
pbSave.setVisibility(View.GONE); pbSave.setVisibility(View.GONE);
grpAuthorize.setVisibility(View.GONE);
grpAdvanced.setVisibility(View.GONE);
return view; return view;
} }

@ -55,7 +55,6 @@ public class FragmentOptions extends FragmentEx implements SharedPreferences.OnS
private SwitchCompat swMetered; private SwitchCompat swMetered;
private Spinner spDownload; private Spinner spDownload;
private SwitchCompat swInsecure;
private SwitchCompat swUnified; private SwitchCompat swUnified;
private SwitchCompat swThreading; private SwitchCompat swThreading;
@ -94,7 +93,6 @@ public class FragmentOptions extends FragmentEx implements SharedPreferences.OnS
swMetered = view.findViewById(R.id.swMetered); swMetered = view.findViewById(R.id.swMetered);
spDownload = view.findViewById(R.id.spDownload); spDownload = view.findViewById(R.id.spDownload);
swInsecure = view.findViewById(R.id.swInsecure);
swUnified = view.findViewById(R.id.swUnified); swUnified = view.findViewById(R.id.swUnified);
swThreading = view.findViewById(R.id.swThreading); swThreading = view.findViewById(R.id.swThreading);
@ -161,14 +159,6 @@ public class FragmentOptions extends FragmentEx implements SharedPreferences.OnS
} }
}); });
swInsecure.setChecked(prefs.getBoolean("insecure", false));
swInsecure.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("insecure", checked).apply();
}
});
swUnified.setChecked(prefs.getBoolean("unified", true)); swUnified.setChecked(prefs.getBoolean("unified", true));
swUnified.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { swUnified.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override @Override

@ -567,7 +567,7 @@
android:id="@+id/grpServer" android:id="@+id/grpServer"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="0dp"
app:constraint_referenced_ids="tvDomain,etDomain,btnAutoConfig,tvImap,tvPop,tvHost,etHost,tvPort,etPort" /> app:constraint_referenced_ids="tvDomain,etDomain,btnAutoConfig,tvImap,tvPop,tvHost,etHost,cbStartTls,cbInsecure,tvPort,etPort" />
<androidx.constraintlayout.widget.Group <androidx.constraintlayout.widget.Group
android:id="@+id/grpAuthorize" android:id="@+id/grpAuthorize"

@ -12,17 +12,36 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="12dp"> android:padding="12dp">
<!--- linked account -->
<TextView
android:id="@+id/tvAccount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/title_account_linked"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Spinner
android:id="@+id/spAccount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvAccount" />
<!-- name --> <!-- name -->
<TextView <TextView
android:id="@+id/tvName" android:id="@+id/tvName"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:autofillHints="name" android:autofillHints="name"
android:text="@string/title_identity_name" android:text="@string/title_identity_name"
android:textAppearance="@style/TextAppearance.AppCompat.Small" android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toBottomOf="@id/spAccount" />
<EditText <EditText
android:id="@+id/etName" android:id="@+id/etName"
@ -53,25 +72,6 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvEmail" /> app:layout_constraintTop_toBottomOf="@id/tvEmail" />
<!--- linked account -->
<TextView
android:id="@+id/tvAccount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_account_linked"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/etEmail" />
<Spinner
android:id="@+id/spAccount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvAccount" />
<TextView <TextView
android:id="@+id/tvDisplay" android:id="@+id/tvDisplay"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -81,7 +81,7 @@
android:text="@string/title_display_name" android:text="@string/title_display_name"
android:textAppearance="@style/TextAppearance.AppCompat.Small" android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/spAccount" /> app:layout_constraintTop_toBottomOf="@id/etEmail" />
<EditText <EditText
android:id="@+id/etDisplay" android:id="@+id/etDisplay"
@ -500,10 +500,16 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<androidx.constraintlayout.widget.Group
android:id="@+id/grpAuthorize"
android:layout_width="0dp"
android:layout_height="0dp"
app:constraint_referenced_ids="tvName,etName,tvEmail,etEmail,tvDisplay,etDisplay,btnColor,vwColor,ibColorDefault,tvSignature,etSignature,ibPro,btnAdvanced,btnSave" />
<androidx.constraintlayout.widget.Group <androidx.constraintlayout.widget.Group
android:id="@+id/grpAdvanced" android:id="@+id/grpAdvanced"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="0dp"
app:constraint_referenced_ids="tvReplyTo,etReplyTo,tvBcc,etBcc,cbDeliveryReceipt,cbReadReceipt,tvReceipt,tvProvider,spProvider,tvDomain,etDomain,btnAutoConfig,tvSmtp,tvHost,etHost,cbStartTls,tvPort,etPort,tvUser,etUser,tvPassword,tilPassword,cbSynchronize,cbPrimary,tvSent,spSent,tvSentHint" /> app:constraint_referenced_ids="tvReplyTo,etReplyTo,tvBcc,etBcc,cbDeliveryReceipt,cbReadReceipt,tvReceipt,tvProvider,spProvider,tvDomain,etDomain,btnAutoConfig,tvSmtp,tvHost,etHost,cbStartTls,cbInsecure,tvPort,etPort,tvUser,etUser,tvPassword,tilPassword,cbSynchronize,cbPrimary,tvSent,spSent,tvSentHint" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView> </ScrollView>

@ -135,18 +135,6 @@
app:barrierDirection="bottom" app:barrierDirection="bottom"
app:constraint_referenced_ids="tvDownload,spDownload" /> app:constraint_referenced_ids="tvDownload,spDownload" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swInsecure"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="12dp"
android:layout_marginEnd="12dp"
android:text="@string/title_allow_insecure"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/barrier1"
app:switchPadding="12dp" />
<TextView <TextView
android:id="@+id/tvSectionDisplay" android:id="@+id/tvSectionDisplay"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -156,7 +144,7 @@
android:text="@string/title_advanced_section_display" android:text="@string/title_advanced_section_display"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" android:textAppearance="@style/TextAppearance.AppCompat.Medium"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swInsecure" /> app:layout_constraintTop_toBottomOf="@id/barrier1" />
<View <View
android:id="@+id/vSeparator3" android:id="@+id/vSeparator3"

Loading…
Cancel
Save