diff --git a/app/src/main/java/eu/faircode/email/EmailProvider.java b/app/src/main/java/eu/faircode/email/EmailProvider.java index 5b86301fd0..5facc9fd87 100644 --- a/app/src/main/java/eu/faircode/email/EmailProvider.java +++ b/app/src/main/java/eu/faircode/email/EmailProvider.java @@ -66,6 +66,7 @@ public class EmailProvider { public int keepalive; public boolean partial; public boolean useip; + public boolean appPassword; public String link; public Server imap = new Server(); public Server smtp = new Server(); @@ -127,6 +128,7 @@ public class EmailProvider { provider.keepalive = xml.getAttributeIntValue(null, "keepalive", 0); provider.partial = xml.getAttributeBooleanValue(null, "partial", true); provider.useip = xml.getAttributeBooleanValue(null, "useip", true); + provider.appPassword = xml.getAttributeBooleanValue(null, "appPassword", false); provider.link = xml.getAttributeValue(null, "link"); provider.type = xml.getAttributeValue(null, "type"); String user = xml.getAttributeValue(null, "user"); diff --git a/app/src/main/java/eu/faircode/email/FragmentQuickSetup.java b/app/src/main/java/eu/faircode/email/FragmentQuickSetup.java index d33cde707f..415490ef49 100644 --- a/app/src/main/java/eu/faircode/email/FragmentQuickSetup.java +++ b/app/src/main/java/eu/faircode/email/FragmentQuickSetup.java @@ -262,6 +262,7 @@ public class FragmentQuickSetup extends FragmentBase { throw new IllegalArgumentException(context.getString(R.string.title_no_password)); EmailProvider provider = EmailProvider.fromEmail(context, email, EmailProvider.Discover.ALL); + args.putBoolean("appPassword", provider.appPassword); if (provider.link != null) args.putString("link", provider.link); @@ -404,9 +405,13 @@ public class FragmentQuickSetup extends FragmentBase { protected void onException(final Bundle args, Throwable ex) { Log.e(ex); - if (ex instanceof AuthenticationFailedException) - tvErrorHint.setText(R.string.title_setup_no_auth_hint); - else + if (ex instanceof AuthenticationFailedException) { + boolean appPassword = args.getBoolean("appPassword"); + String message = getString(R.string.title_setup_no_auth_hint); + if (appPassword) + message += " - " + getString(R.string.title_setup_app_password_hint); + tvErrorHint.setText(message); + } else tvErrorHint.setText(R.string.title_setup_no_settings_hint); if (ex instanceof IllegalArgumentException || ex instanceof UnknownHostException) { diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 2fdf8d2369..e9a386ba08 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -164,6 +164,7 @@ No settings found for domain \'%1$s\' Please try setting up an account and identity in setup steps 1 and 2 using the settings provided by your email provider Please double check your email address and password and make sure external access (IMAP/SMTP) is enabled for your account + This provider requires an app password instead of the account password Inbox or draft folder not found An account and an identity have successfully been added You can try to configure an account and an identity below too diff --git a/app/src/main/res/xml/providers.xml b/app/src/main/res/xml/providers.xml index a5bd2f83bc..5ae4002b67 100644 --- a/app/src/main/res/xml/providers.xml +++ b/app/src/main/res/xml/providers.xml @@ -59,6 +59,7 @@