#358 Ensure lowercase player name, issue cleanup

- Ensure within PasswordSecurity that the player name is lowercase
- Remove check for MD5VB separate salt (we only generate hashes with the salt embedded, so either we need to change that or we don't need this check)
- Remove obsolete TODO
This commit is contained in:
ljacqu
2015-12-30 22:45:18 +01:00
parent 300a621e1c
commit e85dbe81e5
5 changed files with 30 additions and 25 deletions
@@ -30,8 +30,9 @@ public class PasswordSecurity {
}
public EncryptedPassword computeHash(HashAlgorithm algorithm, String password, String playerName) {
EncryptionMethod method = initializeEncryptionMethod(algorithm, playerName);
return method.computeHash(password, playerName);
String playerLowerCase = playerName.toLowerCase();
EncryptionMethod method = initializeEncryptionMethod(algorithm, playerLowerCase);
return method.computeHash(password, playerLowerCase);
}
public boolean comparePassword(String password, String playerName) {
@@ -52,8 +53,9 @@ public class PasswordSecurity {
return false;
}
return method.comparePassword(password, encryptedPassword, playerName)
|| supportOldAlgorithm && compareWithAllEncryptionMethods(password, encryptedPassword, playerName);
String playerLowerCase = playerName.toLowerCase();
return method.comparePassword(password, encryptedPassword, playerLowerCase)
|| supportOldAlgorithm && compareWithAllEncryptionMethods(password, encryptedPassword, playerLowerCase);
}
/**