diff --git a/src/main/java/fr/xephi/authme/service/ValidationService.java b/src/main/java/fr/xephi/authme/service/ValidationService.java index 2b4e72f8fe..710e8f6cf2 100644 --- a/src/main/java/fr/xephi/authme/service/ValidationService.java +++ b/src/main/java/fr/xephi/authme/service/ValidationService.java @@ -30,6 +30,7 @@ import java.util.Locale; import java.util.Set; import java.util.regex.Pattern; +import java.util.regex.PatternSyntaxException; import static fr.xephi.authme.util.StringUtils.isInsideString; @@ -202,13 +203,21 @@ private boolean validateWhitelistAndBlacklist(String value, Property coll, String needle) { for (String entry : coll) { - if (entry.equalsIgnoreCase(needle)) { + if (entry.startsWith("r:")) { + String pattern = entry.substring(2); + try { + if (Pattern.compile(pattern, Pattern.CASE_INSENSITIVE).matcher(needle).matches()) { + return true; + } + } catch (PatternSyntaxException e) { + //possible way to log error? + } + } else if (entry.equalsIgnoreCase(needle)) { return true; } } return false; } - /** * Loads the configured name restrictions into a Multimap by player name (all-lowercase). * diff --git a/src/main/java/fr/xephi/authme/settings/properties/EmailSettings.java b/src/main/java/fr/xephi/authme/settings/properties/EmailSettings.java index f7522b94fb..6987cc5fb0 100644 --- a/src/main/java/fr/xephi/authme/settings/properties/EmailSettings.java +++ b/src/main/java/fr/xephi/authme/settings/properties/EmailSettings.java @@ -63,7 +63,7 @@ public final class EmailSettings implements SettingsHolder { public static final Property> DOMAIN_BLACKLIST = newListProperty("Email.emailBlacklisted", "10minutemail.com"); - @Comment("Whitelist ONLY these domains for emails") + @Comment("Whitelist ONLY these domains for emails. Use 'r:' prefix for regex") public static final Property> DOMAIN_WHITELIST = newListProperty("Email.emailWhitelisted");