Update ChangePasswordCommand.java

This commit is contained in:
Gabriele C. 2015-07-05 14:33:40 +02:00
parent 729e74b155
commit d222b2cbd4

View File

@ -54,17 +54,21 @@ public class ChangePasswordCommand implements CommandExecutor {
} }
String lowpass = args[1].toLowerCase(); String lowpass = args[1].toLowerCase();
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) || lowpass.equalsIgnoreCase(name)) { 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");
return true; return true;
} }
if ((lowpass.equalsIgnoreCase(name){
m.send(player, "password_error_nick");
return true;
}
if (lowpass.length() < Settings.getPasswordMinLen || lowpass.length() > Settings.passwordMaxLength) { if (lowpass.length() < Settings.getPasswordMinLen || lowpass.length() > Settings.passwordMaxLength) {
m.send(player, "pass_len"); m.send(player, "pass_len");
return true; return true;
} }
if (!Settings.unsafePasswords.isEmpty()) { if (!Settings.unsafePasswords.isEmpty()) {
if (Settings.unsafePasswords.contains(lowpass)) { if (Settings.unsafePasswords.contains(lowpass)) {
m.send(player, "password_error"); m.send(player, "password_error_unsafe");
return true; return true;
} }
} }