Fix CrazyCrypt1 need player real case

This commit is contained in:
Xephi 2014-06-14 02:59:44 +02:00
parent 8db9c69ed0
commit 4de55d9efa
4 changed files with 4 additions and 4 deletions

View File

@ -126,7 +126,7 @@ public class API {
String player = playerName.toLowerCase(); String player = playerName.toLowerCase();
PlayerAuth auth = database.getAuth(player); PlayerAuth auth = database.getAuth(player);
try { try {
return PasswordSecurity.comparePasswordWithHash(passwordToCheck, auth.getHash(), player); return PasswordSecurity.comparePasswordWithHash(passwordToCheck, auth.getHash(), playerName);
} catch (NoSuchAlgorithmException e) { } catch (NoSuchAlgorithmException e) {
return false; return false;
} }

View File

@ -56,7 +56,7 @@ public class ChangePasswordCommand implements CommandExecutor {
try { try {
String hashnew = PasswordSecurity.getHash(Settings.getPasswordHash, args[1], name); String hashnew = PasswordSecurity.getHash(Settings.getPasswordHash, args[1], name);
if (PasswordSecurity.comparePasswordWithHash(args[0], PlayerCache.getInstance().getAuth(name).getHash(), name)) { if (PasswordSecurity.comparePasswordWithHash(args[0], PlayerCache.getInstance().getAuth(name).getHash(), player.getName())) {
PlayerAuth auth = PlayerCache.getInstance().getAuth(name); PlayerAuth auth = PlayerCache.getInstance().getAuth(name);
auth.setHash(hashnew); auth.setHash(hashnew);
if (PasswordSecurity.userSalt.containsKey(name) && PasswordSecurity.userSalt.get(name) != null) if (PasswordSecurity.userSalt.containsKey(name) && PasswordSecurity.userSalt.get(name) != null)

View File

@ -64,7 +64,7 @@ public class UnregisterCommand implements CommandExecutor {
return true; return true;
} }
try { try {
if (PasswordSecurity.comparePasswordWithHash(args[0], PlayerCache.getInstance().getAuth(name).getHash(), name)) { if (PasswordSecurity.comparePasswordWithHash(args[0], PlayerCache.getInstance().getAuth(name).getHash(), player.getName())) {
if (!database.removeAuth(name)) { if (!database.removeAuth(name)) {
player.sendMessage("error"); player.sendMessage("error");
return true; return true;

View File

@ -122,7 +122,7 @@ public class AsyncronousLogin {
boolean passwordVerified = true; boolean passwordVerified = true;
if (!forceLogin) if (!forceLogin)
try { try {
passwordVerified = PasswordSecurity.comparePasswordWithHash(password, hash, name); passwordVerified = PasswordSecurity.comparePasswordWithHash(password, hash, realName);
} catch (Exception ex) { } catch (Exception ex) {
ConsoleLogger.showError(ex.getMessage()); ConsoleLogger.showError(ex.getMessage());
m._(player, "error"); m._(player, "error");