Allow unicode email addresses

This commit is contained in:
M66B
2022-02-16 17:54:18 +01:00
parent 65b896dfb5
commit 2c68acc2f4
2 changed files with 3 additions and 15 deletions

View File

@@ -70,7 +70,6 @@ import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.regex.Pattern;
import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
@@ -758,11 +757,8 @@ 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));
Pattern pattern = (unicode ? Helper.EMAIL_ADDRESS_UNICODE : Helper.EMAIL_ADDRESS);
if (!pattern.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));
if (TextUtils.isEmpty(port))