mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-12-22 16:48:21 +01:00
Add emailBlackList domain
This commit is contained in:
parent
aa7415a151
commit
5c3f97f6c7
@ -28,6 +28,9 @@ public class RegisterCommand implements CommandExecutor {
|
||||
sender.sendMessage("Player Only! Use 'authme register <playername> <password>' instead");
|
||||
return true;
|
||||
}
|
||||
if (args.length == 0) {
|
||||
m._(sender, "usage_reg");
|
||||
}
|
||||
if (!plugin.authmePermissible(sender, "authme." + label.toLowerCase())) {
|
||||
m._(sender, "no_perm");
|
||||
return true;
|
||||
@ -44,11 +47,11 @@ public class RegisterCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if(!args[0].contains("@")) {
|
||||
final String email = args[0];
|
||||
if(!Settings.isEmailCorrect(email)) {
|
||||
m._(player, "usage_reg");
|
||||
return true;
|
||||
}
|
||||
final String email = args[0];
|
||||
RandomString rand = new RandomString(Settings.getRecoveryPassLength);
|
||||
final String thePass = rand.nextString();
|
||||
plugin.management.performRegister(player, thePass, email);
|
||||
|
@ -47,6 +47,7 @@ public final class Settings extends YamlConfiguration {
|
||||
public static int purgeDelay = 60;
|
||||
public static List<String> welcomeMsg = null;
|
||||
public static List<String> unsafePasswords;
|
||||
public static List<String> emailBlacklist = null;
|
||||
|
||||
public static Boolean isPermissionCheckEnabled, isRegistrationEnabled, isForcedRegistrationEnabled,
|
||||
isTeleportToSpawnEnabled, isSessionsEnabled, isChatAllowed, isAllowRestrictedIp,
|
||||
@ -249,6 +250,7 @@ public void loadConfigOptions() {
|
||||
crazyloginFileName = configFile.getString("Converter.CrazyLogin.fileName", "accounts.db");
|
||||
getPassRegex = configFile.getString("settings.restrictions.allowedPasswordCharacters","[a-zA-Z0-9_?!@+&-]*");
|
||||
applyBlindEffect = configFile.getBoolean("settings.applyBlindEffect", false);
|
||||
emailBlacklist = configFile.getStringList("Email.emailBlacklisted");
|
||||
|
||||
// Load the welcome message
|
||||
getWelcomeMessage(plugin);
|
||||
@ -412,6 +414,7 @@ public static void reloadConfigOptions(YamlConfiguration newConfig) {
|
||||
crazyloginFileName = configFile.getString("Converter.CrazyLogin.fileName", "accounts.db");
|
||||
getPassRegex = configFile.getString("settings.restrictions.allowedPasswordCharacters","[a-zA-Z0-9_?!@+&-]*");
|
||||
applyBlindEffect = configFile.getBoolean("settings.applyBlindEffect", false);
|
||||
emailBlacklist = configFile.getStringList("Email.emailBlacklisted");
|
||||
|
||||
// Reload the welcome message
|
||||
getWelcomeMessage(AuthMe.getInstance());
|
||||
@ -536,6 +539,9 @@ public static void reloadConfigOptions(YamlConfiguration newConfig) {
|
||||
set("settings.applyBlindEffect", false);
|
||||
changes = true;
|
||||
}
|
||||
if(!contains("Email.emailBlacklisted")) {
|
||||
set("Email.emailBlacklisted", new ArrayList<String>());
|
||||
}
|
||||
|
||||
if (changes) {
|
||||
plugin.getLogger().warning("Merge new Config Options - I'm not an error, please don't report me");
|
||||
@ -737,6 +743,22 @@ public static void reloadConfigOptions(YamlConfiguration newConfig) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isEmailCorrect(String email) {
|
||||
boolean correct = true;
|
||||
if (!email.contains("@"))
|
||||
correct = false;
|
||||
if (!email.equalsIgnoreCase("your@email.com"))
|
||||
correct = false;
|
||||
String emailDomain = email.split("@")[1];
|
||||
for (String domain : emailBlacklist) {
|
||||
if (domain.equalsIgnoreCase(emailDomain)) {
|
||||
correct = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return correct;
|
||||
}
|
||||
|
||||
public enum messagesLang {
|
||||
en, de, br, cz, pl, fr, uk, ru, hu, sk, es, fi, zhtw, zhhk, zhcn, lt, it, ko, pt, nl, gl
|
||||
|
@ -359,6 +359,9 @@ Email:
|
||||
recallPlayers: false
|
||||
# Delay in minute for the recall scheduler
|
||||
delayRecall: 5
|
||||
# Blacklist these domain for emails
|
||||
emailBlacklisted:
|
||||
- 10minutemail.com
|
||||
Hooks:
|
||||
# Do we need to hook with multiverse for spawn checking?
|
||||
multiverse: true
|
||||
|
Loading…
Reference in New Issue
Block a user