mirror of https://github.com/M66B/FairEmail.git
Relaxed email address validation
This commit is contained in:
parent
9c738ab179
commit
9113220c59
|
@ -300,7 +300,7 @@ public class FragmentGmail extends FragmentBase {
|
|||
String password = args.getString("password");
|
||||
|
||||
// Safety checks
|
||||
if (!Patterns.EMAIL_ADDRESS.matcher(user).matches())
|
||||
if (!Helper.EMAIL_ADDRESS.matcher(user).matches())
|
||||
throw new IllegalArgumentException(context.getString(R.string.title_email_invalid, user));
|
||||
if (TextUtils.isEmpty(password))
|
||||
throw new IllegalArgumentException(context.getString(R.string.title_no_password));
|
||||
|
|
|
@ -657,7 +657,7 @@ public class FragmentIdentity extends FragmentBase {
|
|||
throw new IllegalArgumentException(context.getString(R.string.title_no_name));
|
||||
if (TextUtils.isEmpty(email) && !should)
|
||||
throw new IllegalArgumentException(context.getString(R.string.title_no_email));
|
||||
if (!Patterns.EMAIL_ADDRESS.matcher(email).matches() && !should)
|
||||
if (!Helper.EMAIL_ADDRESS.matcher(email).matches() && !should)
|
||||
throw new IllegalArgumentException(context.getString(R.string.title_email_invalid, email));
|
||||
if (TextUtils.isEmpty(host) && !should)
|
||||
throw new IllegalArgumentException(context.getString(R.string.title_no_host));
|
||||
|
|
|
@ -217,7 +217,7 @@ public class FragmentOAuth extends FragmentBase {
|
|||
|
||||
if (TextUtils.isEmpty(email))
|
||||
throw new IllegalArgumentException(getString(R.string.title_no_email));
|
||||
if (!Patterns.EMAIL_ADDRESS.matcher(email).matches())
|
||||
if (!Helper.EMAIL_ADDRESS.matcher(email).matches())
|
||||
throw new IllegalArgumentException(getString(R.string.title_email_invalid, email));
|
||||
}
|
||||
|
||||
|
|
|
@ -256,7 +256,7 @@ public class FragmentQuickSetup extends FragmentBase {
|
|||
throw new IllegalArgumentException(context.getString(R.string.title_no_name));
|
||||
if (TextUtils.isEmpty(email))
|
||||
throw new IllegalArgumentException(context.getString(R.string.title_no_email));
|
||||
if (!Patterns.EMAIL_ADDRESS.matcher(email).matches())
|
||||
if (!Helper.EMAIL_ADDRESS.matcher(email).matches())
|
||||
throw new IllegalArgumentException(context.getString(R.string.title_email_invalid, email));
|
||||
if (TextUtils.isEmpty(password))
|
||||
throw new IllegalArgumentException(context.getString(R.string.title_no_password));
|
||||
|
|
|
@ -127,6 +127,7 @@ import java.util.concurrent.ThreadPoolExecutor;
|
|||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static android.os.Process.THREAD_PRIORITY_BACKGROUND;
|
||||
import static androidx.browser.customtabs.CustomTabsService.ACTION_CUSTOM_TABS_CONNECTION;
|
||||
|
@ -151,6 +152,17 @@ public class Helper {
|
|||
static final String CROWDIN_URI = "https://crowdin.com/project/open-source-email";
|
||||
static final String GRAVATAR_PRIVACY_URI = "https://meta.stackexchange.com/questions/44717/is-gravatar-a-privacy-risk";
|
||||
|
||||
static final Pattern EMAIL_ADDRESS
|
||||
= Pattern.compile(
|
||||
"[\\S]{1,256}" +
|
||||
"\\@" +
|
||||
"[a-zA-Z0-9][a-zA-Z0-9\\-]{0,64}" +
|
||||
"(" +
|
||||
"\\." +
|
||||
"[a-zA-Z0-9][a-zA-Z0-9\\-]{0,25}" +
|
||||
")+"
|
||||
);
|
||||
|
||||
static ExecutorService getBackgroundExecutor(int threads, final String name) {
|
||||
ThreadFactory factory = new ThreadFactory() {
|
||||
private final AtomicInteger threadId = new AtomicInteger();
|
||||
|
|
Loading…
Reference in New Issue