Enable Regexp in registration too

This commit is contained in:
Xephi59 2015-06-28 01:59:10 +02:00
parent 2aab1d67bb
commit 8e010d467c

View File

@ -41,23 +41,28 @@ public class AsyncronousRegister {
} }
protected void preRegister() { protected void preRegister() {
String lowpass = password.toLowerCase();
if (PlayerCache.getInstance().isAuthenticated(name)) { if (PlayerCache.getInstance().isAuthenticated(name)) {
m.send(player, "logged_in"); m.send(player, "logged_in");
allowRegister = false; allowRegister = false;
} }
if (!Settings.isRegistrationEnabled) { else if (!Settings.isRegistrationEnabled) {
m.send(player, "reg_disabled"); m.send(player, "reg_disabled");
allowRegister = false; allowRegister = false;
} }
String lowpass = password.toLowerCase(); else if (!password.matches(Settings.getPassRegex)) {
if ((lowpass.contains("delete") || lowpass.contains("where") || lowpass.contains("insert") || lowpass.contains("modify") || lowpass.contains("from") || lowpass.contains("select") || lowpass.contains(";") || lowpass.contains("null")) || !lowpass.matches(Settings.getPassRegex)) {
m.send(player, "password_error"); m.send(player, "password_error");
allowRegister = false; allowRegister = false;
} }
if (database.isAuthAvailable(name)) { else if ((lowpass.contains("delete") || lowpass.contains("where") || lowpass.contains("insert") || lowpass.contains("modify") || lowpass.contains("from") || lowpass.contains("select") || lowpass.contains(";") || lowpass.contains("null")) || !lowpass.matches(Settings.getPassRegex)) {
m.send(player, "password_error");
allowRegister = false;
}
else if (database.isAuthAvailable(name)) {
m.send(player, "user_regged"); m.send(player, "user_regged");
if (plugin.pllog.getStringList("players").contains(name)) { if (plugin.pllog.getStringList("players").contains(name)) {
plugin.pllog.getStringList("players").remove(name); plugin.pllog.getStringList("players").remove(name);
@ -65,7 +70,7 @@ public class AsyncronousRegister {
allowRegister = false; allowRegister = false;
} }
if (Settings.getmaxRegPerIp > 0) { else if (Settings.getmaxRegPerIp > 0) {
if (!plugin.authmePermissible(player, "authme.allow2accounts") && database.getAllAuthsByIp(getIp()).size() >= Settings.getmaxRegPerIp && !getIp().equalsIgnoreCase("127.0.0.1") && !getIp().equalsIgnoreCase("localhost")) { if (!plugin.authmePermissible(player, "authme.allow2accounts") && database.getAllAuthsByIp(getIp()).size() >= Settings.getmaxRegPerIp && !getIp().equalsIgnoreCase("127.0.0.1") && !getIp().equalsIgnoreCase("localhost")) {
m.send(player, "max_reg"); m.send(player, "max_reg");
allowRegister = false; allowRegister = false;